24.10.2011, 19:56
Heey all,
Anyone know how i can make this variable?
This dont work:S
I need for ransom command:
My problem is when i use command on someone who is kidnapped its says the player is not kidnapped because the variable loads to fast i think.
How i can fix this?
Thanks Admigo
Anyone know how i can make this variable?
This dont work:S
Код:
if(kidnap==0)
{
kidnap=1;
}
if(kidnap==1)
{
kidnap=0;
}
Код:
dcmd_ransom(playerid,params[])
{
new string[128];
new ID;
new kidnapid = GetPVarInt(playerid, "kidnap1");
new vehicleid;
vehicleid = GetPlayerVehicleID(ID);
if(sscanf(params, "i", 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) < KidnapPrice[kidnapid][1])
{
SendClientMessage(playerid,COLOR_RED,"You cannot afford to pay the ransom of this player.");
return 1;
}
if(GetPlayerMoney(playerid) > KidnapPrice[kidnapid][1])
{
if(IsPlayerInVehicle(ID,vehicleid) && IsKidnapped[ID] !=0)
{
new string2[128];
DeletePVar(playerid, "kidnap1");
RemovePlayerFromVehicle(ID);
TogglePlayerControllable(ID,1);
GivePlayerMoney(playerid,-KidnapPrice[kidnapid][1]);
GivePlayerMoney(playerid,KidnapPrice[kidnapid][1]);
format(string2,sizeof(string2),"%s(%d) has paid your ransom so now you are free to go!",PlayerName(playerid),playerid);
IsKidnapped[ID] =0l
SendClientMessage(ID,COLOR_LIGHTBLUE,string2);
}
if(IsPlayerInVehicle(ID,vehicleid) && IsKidnapped[ID] ==0)
{
SendClientMessage(playerid, COLOR_RED, "This player is not kidnapped!");
}
}
return 1;
}
How i can fix this?
Thanks Admigo


