# CMD:placegate( playerid, params[] ) # { # if( isnull( params) ) # return SendClientMessage( playerid, -1, "Syntax: /placegate [password]" ); # # if( !strval( params ) ) # return SendClientMessage( playerid, -1, "You need to input numbers." ); # # if( IsPlayerInAnyVehicle( playerid ) ) # return SendClientMessage( playerid, -1, "You need to exit your vehicle." ); # # new Float:pPos[4]; # GetPlayerPos( playerid, pPos[0], pPos[1], pPos[2] ); # GetPlayerFacingAngle( playerid, pPos[3] ); # CreateGate( playerid, strval( params ), pPos[0], pPos[1], pPos[2], pPos[3] ); # SendClientMessage( playerid, -1, "You succesfully created a movable gate. Use /gopen or /gclose." ); # # return 1; # }
#include <sscanf2>
CMD:placegate(playerid, params[]){
new password, Float:pPos[4];
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage( playerid, -1, "You need to exit your vehicle." );
if(sscanf(params, "i", password)) return SendClientMessage( playerid, -1, "Syntax: /placegate [password]" );
GetPlayerPos( playerid, pPos[0], pPos[1], pPos[2] );
GetPlayerFacingAngle( playerid, pPos[3] );
CreateGate( playerid, strval( params ), pPos[0], pPos[1], pPos[2], pPos[3] );
SendClientMessage( playerid, -1, "You succesfully created a movable gate. Use /gopen or /gclose." );
return 1;
}
if(strcmp(cmd, "/placegate", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Syntax: /placegate [password]");
return 1;
}
if( !strval( string ) )
return SendClientMessage( playerid, -1, "You need to input numbers." );
if( IsPlayerInAnyVehicle( playerid ) )
return SendClientMessage( playerid, -1, "You need to exit your vehicle." );
new Float:pPos[4];
GetPlayerPos( playerid, pPos[0], pPos[1], pPos[2] );
GetPlayerFacingAngle( playerid, pPos[3] );
CreateGate( playerid, strval, pPos[0], pPos[1], pPos[2], pPos[3] );
SendClientMessage( playerid, -1, "You succesfully created a movable gate. Use /gopen or /gclose." );
return 1;
}
I know a little about strcmp. Did a little research. This is what I made
PHP код:
|