SAMP id 0 cant /tk id 1 & same with /ar
#1

hey i dont know why when i am id 1 i cant give tickets but when i am id 0 i cant here the code


ticket command
PHP код:
if(!IsCop(playerid))
        return 
SendClientMessage(playeridCOLOR_RED"Only Cops/Army can use this command.");
    new 
string[120], ID;
    if(
GetDistanceBetweenPlayers(playeridID) > 4)
    {
        return 
SendClientMessage(playeridCOLOR_RED"That player is too far away to Ticket.");
    }
    new 
pwl GetPlayerWantedLevel(ID);
    if(
pwl == 1)
    {
        
format(string120"[COP ACTION] You have been fined by officer %s. You have been charged $1,000"PlayerInfo(playerid));
        
SendClientMessage(IDCOLOR_DODGERBLUEstring);
        
format(string120"[COP ACTION] You have fined %s. You have recieved a collection prize."PlayerInfo(ID));
        
SendClientMessage(playeridCOLOR_DODGERBLUEstring);
        
format(string120"[DISPATCH] Officer %s has fined %s. He is no longer wanted."PlayerInfo(playerid), PlayerInfo(ID));
        
SendCopMessage(string);
        
SetPlayerWantedLevel(ID0);
        
IncreaseScore(playerid1);
        
GivePlayerMoney(playerid2500);
        
GivePlayerMoney(ID, -1000);
    }
    if(
pwl == 2)
    {
         
format(string120"[COP ACTION] You have been fined by officer %s. You have been charged $2,000"PlayerInfo(playerid));
        
SendClientMessage(IDCOLOR_DODGERBLUEstring);
        
format(string120"[COP ACTION] You have fined %s. You have recieved a collection prize."PlayerInfo(ID));
        
SendClientMessage(playeridCOLOR_DODGERBLUEstring);
        
format(string120"[DISPATCH] Officer %s has fined %s. He is no longer wanted."PlayerInfo(playerid), PlayerInfo(ID));
        
SendCopMessage(string);
        
SetPlayerWantedLevel(ID0);
        
IncreaseScore(playerid1);
        
GivePlayerMoney(playerid2500);
        
GivePlayerMoney(ID, -2000);
    }
     if(
pwl == 3)
    {
         
format(string120"[COP ACTION] You have been fined by officer %s. You have been charged $3,000"PlayerInfo(playerid));
        
SendClientMessage(IDCOLOR_DODGERBLUEstring);
        
format(string120"[COP ACTION] You have fined %s. You have recieved a collection prize."PlayerInfo(ID));
        
SendClientMessage(playeridCOLOR_DODGERBLUEstring);
        
format(string120"[DISPATCH] Officer %s has fined %s. He is no longer wanted."PlayerInfo(playerid), PlayerInfo(ID));
        
SendCopMessage(string);
        
SetPlayerWantedLevel(ID0);
        
IncreaseScore(playerid1);
        
GivePlayerMoney(playerid2500);
        
GivePlayerMoney(ID, -3000);
    }
    else
    {
        if(
pwl == 0)
        {
            return 
SendClientMessage(playeridCOLOR_YELLOW"["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"player is innocent!");
        }
        if(
pwl == 4)
        {
            return 
SendClientMessage(playeridCOLOR_YELLOW"["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
        }
        if(
pwl == 5)
        {
            return 
SendClientMessage(playeridCOLOR_YELLOW"["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
        }
        if(
pwl == 6)
        {
            return 
SendClientMessage(playeridCOLOR_YELLOW"["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
        }
    }
    return 
1;

arrest command
PHP код:
command(arplayeridparams[])
{
    if(!
IsCop(playerid))
    {
        return 
SendClientMessage(playeridCOLOR_RED"You are not a Law Enforcement officer.");
    }
    new 
IDstring[200];
    if(
IsPlayerInAnyVehicle(playerid))
    {
        return 
SendClientMessage(playeridCOLOR_RED"You cannot be in a vehicle to use this command.");
    }
    if(!
IsPlayerConnected(ID))
    {
        return 
SendClientMessage(playeridCOLOR_RED"Invalid ID.");
    }
    if(
IsPlayerInAnyVehicle(ID))
 {
        return 
SendClientMessage(playeridCOLOR_RED"You cannot arrest a player inside a vehicle.");
 }
    if(
AccountInfo[ID][pJailed] == 1)
    {
        return 
SendClientMessage(playeridCOLOR_RED"You cannot arrest a jailed person.");
     }
    if(
GetDistanceBetweenPlayers(playeridID) > 4)
    {
        return 
SendClientMessage(playeridCOLOR_RED"That player is too far away to arrest.");
    }
    if(
GetPlayerWantedLevel(ID) <= 1)
    {
        return 
SendClientMessage(playeridCOLOR_RED"The player must have a warrant before you arrest.");
    }
    new 
pwl GetPlayerWantedLevel(ID);
    new 
i;
    if(
pwl == 4)
    {
        
format(stringsizeof(string), "Police Officer %s has arrested wanted suspect %s"PlayerInfo(playerid), PlayerInfo(ID));
        
SendClientMessageToAll(COLOR_BLUEstring);
        
CNR_PrintString(string);
        
format(stringsizeof(string), "[POLICE RADIO] Suspect %s has been sent to jail"PlayerInfo(ID));
        
SendCopMessage(string);
        new 
tdstring[120];
        
format(tdstringsizeof(tdstring), "~g~+~g~~h~$~g~~h~~h~~h~4,000");
        
PlayerTextDrawSetString(playeridWMoney[playerid], tdstring);
           
PlayerTextDrawShow(playeridWMoney[playerid]);
        
SetTimerEx("HideWM"7000true"i"playerid);
        
GivePlayerMoney(playerid4000);
        
IncreaseScore(playerid1);
        
AccountInfo[ID][pJailTime] = 60 ;
        
AccountInfo[ID][pJailed] = ;
        
SetPlayerInterior(ID10);
        new 
rnd random(sizeof(PrisonSpawn));
        
SetPlayerPos(IDPrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
        
SendClientMessage(IDCOLOR_GREY"**LOS SANTOS PRISON**");
        
SendClientMessage(IDCOLOR_LIGHTBLUE"[PRISON] You have been sent to prison. You will be released soon.");
        
SetPlayerWantedLevel(ID0);
          if(
IsPlayerAttachedObjectSlotUsed(IDi)) RemovePlayerAttachedObject(IDi);
        
SetPlayerSpecialAction(IDSPECIAL_ACTION_NONE);
        
AccountInfo[ID][pCuffed] = ;
        return 
1;
    }
    if(
pwl == 5)
    {
        
format(stringsizeof(string), "Police Officer %s has arrested  most wanted suspect %s"PlayerInfo(playerid), PlayerInfo(ID));
        
SendClientMessageToAll(COLOR_BLUEstring);
        
CNR_PrintString(string);
        
format(stringsizeof(string), "[POLICE RADIO] Suspect %s has been sent to jail"PlayerInfo(ID));
        
SendCopMessage(string);
        new 
tdstring[120];
        
format(tdstringsizeof(tdstring), "~g~+~g~~h~$~g~~h~~h~~h~10,000");
        
PlayerTextDrawSetString(playeridWMoney[playerid], tdstring);
           
PlayerTextDrawShow(playeridWMoney[playerid]);
           
SetTimerEx("HideWM"7000true"i"playerid);
        
GivePlayerMoney(playerid10000);
        
IncreaseScore(playerid2);
        
AccountInfo[ID][pJailTime] = 80 ;
        
AccountInfo[ID][pJailed] = ;
        
SetPlayerInterior(ID10);
        new 
rnd random(sizeof(PrisonSpawn));
        
SetPlayerPos(IDPrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
        
SendClientMessage(playeridCOLOR_GREY"**LOS SANTOS PRISON**");
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"[PRISON] You have been sent to prison. You will be released soon.");
        
TogglePlayerControllable(ID1);
        
SetPlayerWantedLevel(ID0);
           if(
IsPlayerAttachedObjectSlotUsed(IDi)) RemovePlayerAttachedObject(IDi);
        
SetPlayerSpecialAction(IDSPECIAL_ACTION_NONE);
        
AccountInfo[ID][pCuffed] = ;
        return 
1;
    }
    if(
pwl == 6)
    {
        
format(stringsizeof(string), "Police Officer %s has arrested most wanted suspect %s"PlayerInfo(playerid), PlayerInfo(ID));
        
SendClientMessageToAll(COLOR_BLUEstring);
        
CNR_PrintString(string);
        
format(stringsizeof(string), "[POLICE RADIO] Suspect %s has been sent to jail"PlayerInfo(ID));
        
SendCopMessage(string);
        new 
tdstring[120];
        
format(tdstringsizeof(tdstring), "~g~+~g~~h~$~g~~h~~h~~h~20,000");
        
PlayerTextDrawSetString(playeridWMoney[playerid], tdstring);
           
PlayerTextDrawShow(playeridWMoney[playerid]);
           
SetTimerEx("HideWM"7000true"i"playerid);
        
GivePlayerMoney(playerid20000);
        
IncreaseScore(playerid2);
        
AccountInfo[ID][pJailTime] = 100 ;
        
AccountInfo[ID][pJailed] = ;
        
SetPlayerInterior(ID10);
        new 
rnd random(sizeof(PrisonSpawn));
        
SetPlayerPos(IDPrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
        
SendClientMessage(playeridCOLOR_GREY"**LOS SANTOS PRISON**");
        
SendClientMessage(playeridCOLOR_LIGHTBLUE"[PRISON] You have been sent to prison. You will be released soon.");
        
TogglePlayerControllable(ID1);
        
SetPlayerWantedLevel(ID0);
           if(
IsPlayerAttachedObjectSlotUsed(IDi)) RemovePlayerAttachedObject(IDi);
        
SetPlayerSpecialAction(IDSPECIAL_ACTION_NONE);
        
AccountInfo[ID][pCuffed] = ;
        return 
1;
    }
    return 
1;

Reply
#2

You only created a variable called 'ID' but you didnt store 'target' id in the variable 'ID'.
You just created 'ID' without storing anything in it, so its value is going to be 0.
Use sscanf in both commands.
Reply
#3

Quote:
Originally Posted by [D]ry[D]esert
Посмотреть сообщение
You only created a variable called 'ID' but you didnt store 'target' id in the variable 'ID'.
You just created 'ID' without storing anything in it, so its value is going to be 0.
Use sscanf in both commands.
like this?
PHP код:
if(sscanf(params"u"ID)) 
Reply
#4

Quote:
Originally Posted by UserName31
Посмотреть сообщение
like this?
PHP код:
if(sscanf(params"u"ID)) 
something like that.
pawn Код:
if(sscanf(params, "u", ID)) return SendClientMessage(playerid,ANY COLOR,"[USAGE] /arrest[playerid]");
Reply
#5

Quote:
Originally Posted by [D]ry[D]esert
Посмотреть сообщение
something like that.
pawn Код:
if(sscanf(params, "u", ID)) return SendClientMessage(playerid,ANY COLOR,"[USAGE] /arrest[playerid]");
i dont want to do /ar [id] i want to do when player is close to cop
Reply
#6

Quote:
Originally Posted by UserName31
Посмотреть сообщение
i dont want to do /ar [id] i want to do when player is close to cop
Then you'll have to use loop.
pawn Код:
for(new ID; ID < MAX_PLAYERS;ID++)
{
}
or
foreach(new ID : Player)
{
}
Reply
#7

Add This:
pawn Код:
if(ID != player) //this checks if the ID from the loop isnt you, if it was you it will avoid it.
{
}
Reply
#8

Quote:
Originally Posted by [D]ry[D]esert
Посмотреть сообщение
Add This:
pawn Код:
if(ID != player) //this checks if the ID from the loop isnt you, if it was you it will avoid it.
{
}
still no effect he full command

i appreciate you time thanks

PHP код:
cmd(tkplayeridparams[])
{
    foreach(new 
ID Player)
    {
    if(
ID != playerid//this checks if the ID from the loop isnt you, if it was you it will avoid it.
    
{
    }
    if(!
IsCop(playerid))
        return 
SendClientMessage(playeridCOLOR_RED"Only Cops/Army can use this command.");
    new 
string[120];
    if(
GetDistanceBetweenPlayers(playeridID) > 4)
    {
        return 
SendClientMessage(playeridCOLOR_RED"That player is too far away to Ticket.");
    }
    new 
pwl GetPlayerWantedLevel(ID);
    if(
pwl == 1)
    {
        
format(string120"[COP ACTION] You have been fined by officer %s. You have been charged $1,000"PlayerInfo(playerid));
        
SendClientMessage(IDCOLOR_DODGERBLUEstring);
        
format(string120"[COP ACTION] You have fined %s. You have recieved a collection prize."PlayerInfo(ID));
        
SendClientMessage(playeridCOLOR_DODGERBLUEstring);
        
format(string120"[DISPATCH] Officer %s has fined %s. He is no longer wanted."PlayerInfo(playerid), PlayerInfo(ID));
        
SendCopMessage(string);
        
SetPlayerWantedLevel(ID0);
        
IncreaseScore(playerid1);
        
GivePlayerMoney(playerid2500);
        
GivePlayerMoney(ID, -1000);
    }
    if(
pwl == 2)
    {
         
format(string120"[COP ACTION] You have been fined by officer %s. You have been charged $2,000"PlayerInfo(playerid));
        
SendClientMessage(IDCOLOR_DODGERBLUEstring);
        
format(string120"[COP ACTION] You have fined %s. You have recieved a collection prize."PlayerInfo(ID));
        
SendClientMessage(playeridCOLOR_DODGERBLUEstring);
        
format(string120"[DISPATCH] Officer %s has fined %s. He is no longer wanted."PlayerInfo(playerid), PlayerInfo(ID));
        
SendCopMessage(string);
        
SetPlayerWantedLevel(ID0);
        
IncreaseScore(playerid1);
        
GivePlayerMoney(playerid2500);
        
GivePlayerMoney(ID, -2000);
    }
     if(
pwl == 3)
    {
         
format(string120"[COP ACTION] You have been fined by officer %s. You have been charged $3,000"PlayerInfo(playerid));
        
SendClientMessage(IDCOLOR_DODGERBLUEstring);
        
format(string120"[COP ACTION] You have fined %s. You have recieved a collection prize."PlayerInfo(ID));
        
SendClientMessage(playeridCOLOR_DODGERBLUEstring);
        
format(string120"[DISPATCH] Officer %s has fined %s. He is no longer wanted."PlayerInfo(playerid), PlayerInfo(ID));
        
SendCopMessage(string);
        
SetPlayerWantedLevel(ID0);
        
IncreaseScore(playerid1);
        
GivePlayerMoney(playerid2500);
        
GivePlayerMoney(ID, -3000);
    }
    else
    {
        if(
pwl == 0)
        {
            return 
SendClientMessage(playeridCOLOR_YELLOW"["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"player is innocent!");
        }
        if(
pwl == 4)
        {
            return 
SendClientMessage(playeridCOLOR_YELLOW"["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
        }
        if(
pwl == 5)
        {
            return 
SendClientMessage(playeridCOLOR_YELLOW"["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
        }
        if(
pwl == 6)
        {
            return 
SendClientMessage(playeridCOLOR_YELLOW"["COL_GREY"Error"COL_YELLOW"]"COL_GREY":"COL_LRED"You only can give ticket to wanted players of 1 to 3!");
        }
    }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)