11.01.2015, 04:59
hello i want if i didnt type the reason it will just eject the player without send to him the reason i used isnull but its not work
PHP Code:
CMD:aj(playerid,params[])
{
new TargetID, reason[100], name[24], tname[24], str[100];
if(pdata[playerid][Adminstator] < 2) return SendClientMessage(playerid,Red,"Command not found! Type /cmds");
if(sscanf(params, "us[100]",TargetID,reason)) return SendClientMessage(playerid,Red,"Eject player from vehicle: /aj <id> <reason>");
if(!IsPlayerConnected(TargetID)) return SendClientMessage(playerid,Red,"Player is not connected");
if(IsPlayerInAnyVehicle(TargetID))
{
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),"%s %s ejected you: %s",AdminLevel(playerid),name,reason);
SendClientMessage(TargetID,Red,str);
RemovePlayerFromVehicle(TargetID);
}
else
{
SendClientMessage(playerid,Red,"Player is not in vehicle");
}
if(isnull(reason))
{
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),"%s %s ejected you",AdminLevel(playerid),name);
SendClientMessage(TargetID,Red,str);
RemovePlayerFromVehicle(TargetID);
}
return 1;
}