What's wrong with this command?
#6

Use sscanf to assign targetid to whatever the user is typing in. Make sure you understand this, also you have a grammar issue in the script in your timer but I haven't changed it.

PHP код:
CMD:breakcuff(playeridparams[]) 

    if(
PoliceTeam(GetPlayerSkin(playerid))) return SendClientMessage(playerid, -1"{FF0000}[NayaBOT]: {FFFFFF}You cannot use this command."); 
    {
        new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[170], ArrestReward random(15000) + 2500;
        if (
sscanf(params"u"targetid))
            return 
SendClientMessage(playerid, -1"{FF0000}[NayaBOT]: {FFFFFF}/breakcuffs [playerid/name]");
        if (
targetid == INVALID_PLAYER_ID || !IsPlayerNearPlayer(playeridtargetid6.0))
        return 
SendClientMessage(playerid, -1"{FF0000}[NayaBOT]: {FFFFFF}The specified player is disconnected or not near you.");
        if(
TryingArrested[targetid] == && Civilian(GetPlayerSkin(targetid))) 
        { 
            switch(
random(100)) 
            { 
                case 
0..35
                { 
                    
GetPlayerName(targetidtNamesizeof(tName)); 
                    
KillTimer(SecdonsToJail[targetid]); 
                    
TryingArrested[targetid] = 0
                    
SetPlayerWantedLevel(targetid3); 
                    
SetPlayerColor(targetidCOLOR_YELLOW); 
                    
format(string,sizeof(string), "{808000}%s(%d) {FFFFFF}has {808000}escaped {FFFFFF}from his HANDCUFFS!! {808000}(Being Arrested)"tName,targetid); 
                    
SendClientMessageToAll(-1string); 
                    
GameTextForPlayer(targetid"~g~ESCAPED ~W~FROM ~R~ARRESTED!!"50005); 
                } 
                case 
36..100
                { 
                    if(
ArrestReward GetPlayerCash(playerid)) 
                    
GetPlayerName(targetidtNamesizeof(tName)); 
                    
GetPlayerName(playeridpNamesizeof(pName)); 
                    
TryingArrested[targetid] = 0
                    
ResetPlayerWeapons(targetid); 
                     
                    
format(stringsizeof(string), "{808000}%s(%d) {ffffff}has been {808000}ARRESTED {ffffff}by {00FFFF}S.W.A.T %s(%d){ffffff}!! Wanted Level: {00FFFF}%d."tName,targetidpName,playerid,GetPlayerWantedLevel(targetid)); 
                    
SendClientMessageToAll(yellowstring); 
                       
                    
format(stringsizeof(string), "~y~ARRESTED BY %s(%d)~n~~W~YOU LOST ~R~$%d"pNameplayerid, -ArrestReward); 
                    
GameTextForPlayer(targetidstring40005); 
                     
                    
format(stringsizeof(string), "~g~ARRESTED ~y~%s(%d)~n~~W~YOU GOT ~R~$%d"tNametargetidArrestReward); 
                    
GameTextForPlayer(playeridstring40005); 
                     
                    
format(stringsizeof(string), "{808000}%s(%d) {ffffff}has {ff0000}failed {ffffff}to escaped from his Handcuffs!! {808000}(Being Arrested)"tName,targetid); 
                    
SendClientMessageToAll(yellowstring); 
                     
                    
GivePlayerMoney(targetid, -ArrestReward); 
                    
GivePlayerMoney(playeridArrestReward); 
                } 
            } 
        } 
        else 
SendClientMessage(playerid, -1"{FF0000}Error: {FFFFFF}You can use this command only while being cuffed or arrested."); 
    } 
    return 
1

Reply


Messages In This Thread
What's wrong with this command? - by Thanks - 10.07.2018, 23:29
Re: What's wrong with this command? - by JasonRiggs - 10.07.2018, 23:52
Re: What's wrong with this command? - by Thanks - 11.07.2018, 00:05
Re: What's wrong with this command? - by JasonRiggs - 11.07.2018, 00:23
Re: What's wrong with this command? - by Thanks - 11.07.2018, 00:31
Re: What's wrong with this command? - by Tass007 - 11.07.2018, 00:44
Re: What's wrong with this command? - by JasonRiggs - 11.07.2018, 00:46
Re: What's wrong with this command? - by Thanks - 11.07.2018, 00:50
Re: What's wrong with this command? - by Tass007 - 11.07.2018, 00:59
Re: What's wrong with this command? - by Thanks - 11.07.2018, 01:14

Forum Jump:


Users browsing this thread: 1 Guest(s)