What's wrong with this command?
#8

Quote:
Originally Posted by Tass007
Посмотреть сообщение
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

Error:
PHP код:
error 017undefined symbol "IsPlayerNearPlayer"
if (targetid == INVALID_PLAYER_ID || !IsPlayerNearPlayer(playeridtargetid6.0)) 
Quote:
Originally Posted by JasonRiggs
Посмотреть сообщение
No because it's nothing from the command itself, You should do something like.. An array defined globally that stores the ID of the player getting arrested, so you can use this array instead of "targetid".. Example:

You can create either an array or an enum..

PHP код:
enum pinfo
{
     
pArresting
}
new 
PlayerInfo[MAX_PLAYERS][pinfo]; 
or an array..

PHP код:
new ArrestingPlayer[MAX_PLAYERS]; 
PHP код:
cmd:arrest(playeridparams[])
{
      new 
targetid;
      if(
sscanf(params"u"targetid)) return SendClientMessage(playeridCOLOR_RED"/arrest [target]");
      
ArrestingPlayer[playerid] = targetid;

or
PHP код:
cmd:arrest(playeridparams[])
{
      new 
targetid;
      if(
sscanf(params"u"targetid)) return SendClientMessage(playeridCOLOR_RED"/arrest [target]");
      
PlayerInfo[playerid][pArresting] = targetid;

and instead of using "targetid" in the "/bc" command, use the enum or the array..
I already creating a command for it..

PHP код:
CMD:ar(playeridparams[])
{
    if(!
PoliceTeam(GetPlayerSkin(playerid)) && !SWAT(GetPlayerSkin(playerid)) && !Army(GetPlayerSkin(playerid)) && !FBII(GetPlayerSkin(playerid)) && !CIA(GetPlayerSkin(playerid))) return SendClientMessage(playerid0xE74C3CFF"{FF0000}Error: {FFFFFF}Only Law Enforcement may use this command.");
    new 
pName[MAX_PLAYER_NAME],tName[MAX_PLAYER_NAME],targetid,string[128];
    new 
Float:targetidpos[3];
    if(
GetPlayerInterior(targetid) > 0) return SendClientMessage(playeridred"ERROR: You can't arrest players inside an interior.");
    if(
sscanf(params"ui"targetid)) return SendClientMessage(playeridCOLOR_WHITE"USAGE: /ar <playerid> / <PlayerName>");
    if(
GetPVarInt(playerid,"ArTime")>GetTickCount())return SendClientMessage(playerid,0xFF0000FF,"Please wait 5 seconds before arresting a suspect again.");
    if(
PlayerInfo[targetid][pJailed] == 1) return SendClientMessage(playeridred"This player is already in jail,you can't arrest him.");
    if(
IsPlayerInAnyVehicle(targetid)) return SendClientMessage(playerid,red,"You can't arrest players if they're in a vehicle.");
    if(
GetPlayerWantedLevel(targetid) <= 3) return SendClientMessage(playeridred"ERROR: You can't arrest players with wanted level lower than 4.Use /tk to issue a ticket,or press 2.");
    if(
GetPlayerWantedLevel(targetid) == 0) return SendClientMessage(playeridred"This player is not wanted,you can't arrest him");
    if(
playerid == targetid) return SendClientMessage(playerid,red"You can't arrest yourself,you stupid or what?");
    
GetPlayerPos(playeridtargetidpos[0], targetidpos[1], targetidpos[2]);
    if (!
IsPlayerInRangeOfPoint(playerid5.0targetidpos[0], targetidpos[1], targetidpos[2])) return SendClientMessage(playerid, -1"Nobody close enough to arrest.");
        
GetPlayerName(playeridpNamesizeof(pName));
        
GetPlayerName(targetidtNamesizeof(tName));
        if(
IsPlayerConnected(targetid))
        {
            if(
GetPlayerWantedLevel(targetid) >= 4)
            {
                
SecdonsToJail[targetid] = SetTimerEx("JailPlayer",5000,0,"i",targetid);
                
TryingArrested[targetid] = 1;
                
format(stringsizeof(string), "{0080FF}[BEING ARRESTED]: {FFFFFF}S.W.A.T %s(%d) has put {ADFF2F}Handcuffs {FFFFFF}on you."pNameplayerid);
                
SendClientMessage(targetidredstring);
                
ShowDescriptionText(targetidstring);
                
SetPlayerAttachedObject(targetid9194186, -0.0110000.028000, -0.022000, -15.600012, -33.699977, -81.7000350.8919991.0000001.168000);
                
SetPlayerSpecialAction(targetidSPECIAL_ACTION_CUFFED);
                
format(stringsizeof(string), "~W~AN ~B~F.B.I %s(%d) ~W~HAS CUFFED YOU!!~n~~b~PRESS [/BC] TO ESCAPE FROM THE ~Y~ARREST"pNameplayerid);
                
GameTextForPlayer(targetidstring40005);
                
format(stringsizeof(string), "{33B5FF}[BEGIN ARRESTED!!!] S.W.A.T %s(%d) trying to arrest you!! {33B5FF}Use /BC for escape from this arrested!!"pNameplayerid);
                
SendClientMessage(targetidredstring);
                
ShowDescriptionText(playeridstring);
                
                
format(stringsizeof(string), "{ffffff}You have placed {0080FF}%s(%d) {FFFFFF}in Handcuffs for an Arrest. Use {0080FF}/search (id) {FFFFFF}to search Him for illegal Drugs."tNametargetid);
                   
SendClientMessage(playeridredstring);
                
ShowDescriptionText(playeridstring);
                
SetPVarInt(playerid,"ArTime",GetTickCount()+5000);
                }
                }
                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: 3 Guest(s)