id 0 wont get arrested on detain? sscanf
#1

hey 0 wont go to jail on detain checkpoint?

when id 1 detain me and drop me in the detain checkpoint it wont send me to jail but if id 0 detain if 1 id 1 goes to jail i try ed bots already didnt worked

here code

PHP код:
Checkpoint[1] = CreateDynamicCP(1541.5448,-1655.8884,13.55902.0, -1, -1, -150); 
PHP код:
if(checkpointid == Checkpoint[1]) 
    { 
            new 
ID
            new 
pwl GetPlayerWantedLevel(ID); 
            new 
i
            new 
string[256]; 
            if(
pwl == 4
            { 
                if(
GetPlayerState(ID) == PLAYER_STATE_PASSENGER && GetPlayerState(playerid) == PLAYER_STATE_DRIVER
                { 
                        
TogglePlayerDynamicCP(playerid,Checkpoint[1], true); 
                        
format(stringsizeof(string), "Police Officer %s has arrested wanted suspect %s"PlayerInfo(playerid), PlayerInfo(ID)); 
                        
SendClientMessageToAll(COLOR_LIGHTBLUEstring); 
                        
CNR_PrintString(string); 
                        
format(stringsizeof(string), "[POLICE RADIO] Suspect %s has been sent to jail"PlayerInfo(ID)); 
                        
SendCopMessage(string); 
                        
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."); 
                        
TogglePlayerControllable(ID1); 
                        
SetPlayerWantedLevel(ID0); 
                          if(
IsPlayerAttachedObjectSlotUsed(IDi)) RemovePlayerAttachedObject(IDi); 
                        
SetPlayerSpecialAction(IDSPECIAL_ACTION_NONE); 
                        
AccountInfo[ID][pCuffed] = 
                        
TextDrawHideForPlayer(playeridCF[playerid]); 
                        
GivePlayerMoney(playerid6500); 
                        
IncreaseScore(playerid1); 
                        
TogglePlayerDynamicCP(IDCheckpoint[1], false); 
                        
TogglePlayerDynamicCP(playeridCheckpoint[1], false); 
                } 
                return 
1
            } 
            if(
pwl == 5
            { 
                  if(
GetPlayerState(ID) == PLAYER_STATE_PASSENGER && GetPlayerState(playerid) == PLAYER_STATE_DRIVER
                { 
                        
format(stringsizeof(string), "Police Officer %s has arrested wanted suspect %s"PlayerInfo(playerid), PlayerInfo(ID)); 
                        
SendClientMessageToAll(COLOR_LIGHTBLUEstring); 
                        
CNR_PrintString(string); 
                        
format(stringsizeof(string), "[POLICE RADIO] Suspect %s has been sent to jail"PlayerInfo(ID)); 
                        
SendCopMessage(string); 
                        
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(IDCOLOR_GREY"**LOS SANTOS PRISON**"); 
                        
SendClientMessage(IDCOLOR_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] = 
                        
GivePlayerMoney(playerid7500); 
                        
IncreaseScore(playerid1); 
                        
TextDrawHideForPlayer(playeridCF[playerid]); 
                        
TextDrawHideForPlayer(playeridPNotifications[playerid]); 
                        
TogglePlayerDynamicCP(IDCheckpoint[1], false); 
                } 
                return 
1
           } 
              if(
pwl == 6
            { 
                  if(
GetPlayerState(ID) == PLAYER_STATE_PASSENGER && GetPlayerState(playerid) == PLAYER_STATE_DRIVER
                { 
                        
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); 
                        
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(IDCOLOR_GREY"**LOS SANTOS PRISON**"); 
                        
SendClientMessage(IDCOLOR_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] = 
                        
GivePlayerMoney(playerid10000); 
                        
IncreaseScore(playerid1); 
                        
TogglePlayerDynamicCP(IDCheckpoint[1], false); 
                        
TogglePlayerDynamicCP(playeridCheckpoint[1], false); 
                } 
                return 
1
            } 
        } 
    return 
1
    } 
/detain
PHP код:
cmd(detainplayeridparams[])
{
    new 
ID; new string[200];
    if(!
IsCop(playerid))
        return 
SendClientMessage(playeridCOLOR_RED"You are not a Law Enforcement officer.");
    if(
AccountInfo[playerid][pSpawned] == 0)
        return 
SendClientMessage(playeridCOLOR_RED"You cannot use this command at this time.");
    if(
sscanf(params"u"ID))
        return 
SendClientMessage(playeridCOLOR_RED"Usage: /detain (ID)");
    if(!
IsPlayerConnected(ID))
        return 
SendClientMessage(playeridCOLOR_RED"Invalid ID.");
    if(
AccountInfo[ID][pJailed] == 1)
    {
        
format(stringsizeof(string), "~r~~h~You cannot detain a prisiner.");
        
TextDrawSetString(PNotifications[playerid],string);
          
TextDrawShowForPlayer(playeridPNotifications[playerid]);
          
SetTimer("NTF"30000);
    }
    if(
AccountInfo[ID][pCuffed] == 0)
    {
           
format(stringsizeof(string), "~r~~h~You must cuff before detaining Suspect.");
        
TextDrawSetString(PNotifications[playerid],string);
          
TextDrawShowForPlayer(playeridPNotifications[playerid]);
          
SetTimer("NTF"30000);
    }
    if(
IsPlayerInAnyVehicle(playerid))
        return 
SendClientMessage(playeridCOLOR_RED"You cannot use this command in a vehicle.");
    if(
IsPlayerInAnyVehicle(ID))
        return 
SendClientMessage(playeridCOLOR_RED"You cannot detain that player. He/She is in a vehicle.");
    if(
playerid == ID)
        return 
SendClientMessage(playeridCOLOR_RED"You cannot detain yourself.");
    if(
AccountInfo[playerid][pLastVehicle] == 0)
        return 
SendClientMessage(playeridCOLOR_RED"You must enter a vehicle first.");
    if(
GetDistanceBetweenPlayers(playeridID) > 4)
        return 
SendClientMessage(playeridCOLOR_RED"That playeris too far away.");
    if(
GetPlayerWantedLevel(ID) <= 1)
        return 
SendClientMessage(playeridCOLOR_RED"You cannot detain this player.");
    
format(string200"[DISPATCH] Officer %s has taken %s and detained them.",PlayerInfo(playerid), PlayerInfo(ID));
    
SendCopMessage(string);
    
format(string200"[POLICE] Officer %s has detained %s."PlayerInfo(playerid), PlayerInfo(ID));
    
SendClientMessageToAll(COLOR_DODGERBLUEstring);
    
CNR_PrintString(string);
    
SendClientMessage(playeridCOLOR_GREY"**LOST SANTOS POLICE**");
    
SendClientMessage(playeridCOLOR_GREY"You have been detained. You will be taken to jail shortly.");
    
AccountInfo[ID][pCuffed] = 1;
    
AccountInfo[ID][pCuffTimer] = 200;
    
TextDrawHideForPlayer(IDCF[playerid]);
    
PutPlayerInVehicle(IDAccountInfo[playerid][pLastVehicle], 1);
    
SetPlayerScore(playerid1);
    
GivePlayerMoney(playerid10000);
    
SetPlayerHealth(ID100);
    
TogglePlayerDynamicCP(playerid,Checkpoint[1], true);
    
TogglePlayerDynamicCP(ID,Checkpoint[1], true);
    return 
1;

Reply
#2

Man, "ID" will always be 0 as it isn't being asigned a player id.
Reply
#3

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Man, "ID" will always be 0 as it isn't being asigned a player id.
how do i do that?
Reply
#4

There's a lot of ways, you could store the detained player's id in a variable and use it to perform the action. It's up to you..
Reply
#5

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
There's a lot of ways, you could store the detained player's id in a variable and use it to perform the action. It's up to you..
yea it sound good what the easy methond for it?
Reply
#6

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
There's a lot of ways, you could store the detained player's id in a variable and use it to perform the action. It's up to you..
can you give me an idea or a example plz
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)