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;
}
|
Heey all,
Код:
if(kidnap==0)
{
kidnap=1;
}
if(kidnap==1)
{
kidnap=0;
}
|
if(kidnap==0)
{
kidnap=1;
}
else if(kidnap==1) //you forgot the "else" :)
{
kidnap=0;
}
kidnap=1-kidnap;
switch(kidnap)
{
case 0:
{
kidnap=1;
}
case 1:
{
kidnap=0;
}
}
new kidnap;
if(kidnap==0)
{
kidnap=1;
}
else if(kidnap==1)
{
kidnap=0;
}
if(kidnap==0)
{
kidnap=1;
}
if(kidnap==1)
{
kidnap=0;
}
if(kidnap==0)
{
kidnap=1;
}
else if(kidnap==1)
{
kidnap=0;
}