command not respond. -
I made a ransom command for kidnappers. Sometimes the command dont respond:i fill in the command and nothing happens.
Код:
dcmd_ransom(playerid,params[])
{
new string[128];
new ID;
new ransomid = GetPVarInt(playerid, "ransom1");
new vehicleid;
vehicleid = GetPlayerVehicleID(ID);
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /ransom (id)");
return 1;
}
if(!IsPlayerConnected(ID))
{
format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot ransom them",ID);
SendClientMessage(playerid,COLOR_RED,string);
return 1;
}
if(GetPlayerMoney(playerid) < 10000)
{
SendClientMessage(playerid,COLOR_RED,"You cannot afford to pay the ransom of this player.");
return 1;
}
if(GetPlayerMoney(playerid) > 10000)
{
if(IsPlayerInVehicle(ID,vehicleid) && IsKidnapped[ID] !=0)
{
//TextDrawShowForPlayer(playerid,TextDraw16);
//TextDrawShowForPlayer(playerid,TextDraw17);
//GivePlayerMoney(ID, RansomPrice[ransomid][1]);
format(string,sizeof(string),"You have paid %s's(%d) Ransom for $10000 and is now free to go!",ID,playerid);
SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
DeletePVar(playerid, "ransom1");
//GivePlayerMoney(playerid,-RansomPrice[ransomid][1]);
//IsKidnapped[ID] =0;
//RemovePlayerFromVehicle(ID);
//TogglePlayerControllable(ID,1);
//if(IsPlayerConnected(GetPVarInt(playerid, "kidnapticket")) && GetPVarType(playerid, "kidnapticket") != 0) {
//GivePlayerMoney(GetPVarInt(playerid, "kidnapTicket"), 10000);// RansomPrice[ransomid][1]
//GivePlayerMoney(playerid, -10000);
GivePlayerMoney(ransomid,10000);
GivePlayerMoney(playerid,-10000);
RemovePlayerFromVehicle(ID);
TogglePlayerControllable(ID,1);
IsKidnapped[ID] =0;
//DeletePVar(playerid, "kidnapticket");
//}
}
else if(IsPlayerInVehicle(ID,vehicleid) && IsKidnapped[ID] ==0 || GetPlayerState(ID) == PLAYER_STATE_ONFOOT)
{
SendClientMessage(playerid, COLOR_RED, "This player is not kidnapped!");
}
}
return 1;
}