Jump to content
  • 0

CMD:UP ,problem


SpriTe_

Question

Salut SA-MP.ro, cerez un GM acum si am o problema cu comanda CMD:up, iata scriptul:

[pawn]

CMD:up( playerid, params[ ] )

{

new Float:x, Float:y, Float:z;

new string[ 128 ];

new height = strval( string );

if ( height == 0 ) return SendClientMessage( playerid, COLOR_RED, "USAGE: {FFFF00}/up <Height>" );

if ( IsPlayerInAnyVehicle( playerid ) )

{

GetVehiclePos( GetPlayerVehicleID( playerid ), x, y, z );

SetVehiclePos( GetPlayerVehicleID( playerid ), x, y, z + height );

}

else

{

GetPlayerPos( playerid, x, y, z );

GivePlayerWeapon( playerid, 46, 1 );

SetPlayerPos( playerid, x, y, z + height );

}

return 1;

}

[/pawn]

Deci sa va explic, ca exemplu eu intru in joaca, scriu comanda /up 5 ( acest 5 indica inaltimea ), dupa ce scriu asta, nu ma ridica in sus, dar apare in chat ca nu folosesc corect, adica apare linia asta din comanda:

[pawn]

if ( height == 0 ) return SendClientMessage( playerid, COLOR_RED, "USAGE: {FFFF00}/up <Height>" );

[/pawn]

Care e greseala, am omis ceva?

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

[pawn]

CMD:up( playerid , params [ ] )

{

    new Float:x, Float:y, Float:z;

        tmp = strtok(cmdtext, idx);

        new height = strval(tmp);

        if(height != 0)

        {

            if(IsPlayerInAnyVehicle(playerid))

            {

            GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);

            SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z + height);

            }

            else

            {

GetPlayerPos(playerid, x, y, z);

GivePlayerWeapon(playerid, 46, 1);

SetPlayerPos(playerid, x, y, z + height);

}

}

else

{

    SendClientMessage(playerid, COLOR_WHITE, "Folosire corecta:{FF0000}/up <inaltime>");

}

return 1;

}

[/pawn]

ia vezi asta merge?:))

 

 

430x73_FFFFFF_FF9900_000000_000000.png

 
Link to comment
Share on other sites

[pawn]CMD:up( playerid , params [ ] )

{

new

height                                      ,

vehicleid = GetPlayerVehicleID ( playerid ) ,

Float:Pos [ 3 ]

;

  if ( sscanf ( params , "d" , height ) ) return SendClientMessage ( playerid , 0xFFFFFFFF , "USAGE: /up [height]" ) ;

if ( IsPlayerInAnyVehicle ( playerid ) )

{

            GetVehiclePos ( vehicleid , x , y , z ) ;

  SetVehiclePos ( vehicleid , x , y , z + height ) ;

}

else

{

GetPlayerPos ( playerid , x , y , z ) ;

SetPlayerPos ( playerid , x , y , z + height );

GivePlayerWeapon ( playerid , 46 , 1 ) ;

}

return ( 1 ) ;

}[/pawn]

Link to comment
Share on other sites

Hey am gasit ru o comanda pe sscanf in PC,si am pus-o in , dar am o problema la linia asta:

[pawn]

if( sscanf(params, "i", params[0]) ) return SendClientMessage( playerid, "/up [HIGH]");

[/pawn]

Cu eraorea asta:

[pawn]

error 035: argument type mismatch (argument 2)

[/pawn]

Ce-i gresit?

EDIT

Am rezolvat, iata comanda corecta:

[pawn]

CMD:up( playerid, params[ ] )

{

if( sscanf(params, "i", params[0]) ) return SendClientMessage( playerid, -1, "/UP [HIGH]");

new Float:x, Float:y, Float:z;

if(IsPlayerInAnyVehicle(playerid))

{

GetVehiclePos(GetPlayerVehicleID(playerid), x, y, z);

SetVehiclePos(GetPlayerVehicleID(playerid), x, y, z + params[0]);

}

else

{

GetPlayerPos(playerid, x, y, z);

GivePlayerWeapon(playerid, 46, 1);

SetPlayerPos(playerid, x, y, z + params[0]);

}

return 1;

}

[/pawn]

T/C

Link to comment
Share on other sites

Hey am gasit ru o comanda pe sscanf in PC,si am pus-o in , dar am o problema la linia asta:

[pawn]

if( sscanf(params, "i", params[0]) ) return SendClientMessage( playerid, "/up [HIGH]");

[/pawn]

Cu eraorea asta:

[pawn]

error 035: argument type mismatch (argument 2)

[/pawn]

Ce-i gresit?

Pune asa:

SendClientMessage ( playerid , 0xFFFFFFFF , "USAGE: /up [height]" ) ;

LISTA - GAMEMODE-URI SA-MP - Le gasiti pe toate aici: http://twiriock.com/3MGP

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.