Change command
#1

Hy , I have a roleplay gamemod and i want to change a command

The command i wanna change is /su

My present command is /su [playerid/name] [reason] if i want to give that player wanted 4 i need to do this command 4 times so i wanna change it to /su [playerid/name] [wanted level] [reason]
the command code is:
Код:
//----------------------------------[SetCrim]-----------------------------------------------
	if(strcmp(cmd, "/suspect", true) == 0 || strcmp(cmd, "/su", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    if(OnDuty[playerid] != 1  && PlayerInfo[playerid][pMember] == 1)
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You are not on Duty!");
			    return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [crime discription]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (gTeam[playerid] == 2 || IsACop(playerid))
			{
				if(IsPlayerConnected(giveplayerid))
				{
				    if(giveplayerid != INVALID_PLAYER_ID)
				    {
						if (gTeam[giveplayerid] != 2)
						{
							GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
							new length = strlen(cmdtext);
							while ((idx < length) && (cmdtext[idx] <= ' '))
							{
								idx++;
							}
							new offset = idx;
							new result[64];
							while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
							{
								result[idx - offset] = cmdtext[idx];
								idx++;
							}
							result[idx - offset] = EOS;
							if(!strlen(result))
							{
								SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/su)spect [playerid/PartOfName] [crime text]");
								return 1;
							}
							if(WantedPoints[giveplayerid] == 0) { WantedPoints[giveplayerid] = 3; }
							else { WantedPoints[giveplayerid]+= 2; }
							SetPlayerCriminal(giveplayerid,playerid, result);
							return 1;
						}
						else
						{
							SendClientMessage(playerid, COLOR_GRAD2, "   You can't suspect a Cop !");
						}
					}
				}
				else
				{
						format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
						SendClientMessage(playerid, COLOR_GRAD1, string);
						return 1;
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD2, "   You are not a Cop / FBI / National Guard !");
			}
		}
		return 1;
	}
Please help me and forgive me if i wrong somewhere my english is bad...
Reply
#2

Where

//----------------------------------[SetCrim]-----------------------------------------------
PHP код:
 if(strcmp(cmd"/suspect"true) == || strcmp(cmd"/su"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            
tmp strtok(cmdtextidx);
            if(!
strlen(tmp))
            {
                
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /(su)spect [playerid/PartOfName] [wantedlevel] [reason]");
                return 
1;
            }
            new 
playa;
            new 
money;
            
playa ReturnUser(tmp);
            
tmp strtok(cmdtextidx);
            
money strval(tmp);
            if (
IsACop(playerid))
            {
                if(
IsPlayerConnected(playa))
                {
                    if(
playa != INVALID_PLAYER_ID)
                    {
                        new 
length strlen(cmdtext);
                        while ((
idx length) && (cmdtext[idx] <= ' '))
                        {
                            
idx++;
                        }
                        new 
offset idx;
                        new 
result[64];
                        while ((
idx length) && ((idx offset) < (sizeof(result) - 1)))
                        {
                            
result[idx offset] = cmdtext[idx];
                            
idx++;
                        }
                        
result[idx offset] = EOS;
                        if(!
strlen(result))
                        {
                            
SendClientMessage(playeridCOLOR_GRAD2"USAGE: /(su)spect [playerid/PartOfName] [wlevel] [reason]");
                            return 
1;
                          }
                        if (
gTeam[playa] == || IsACop(playa))
                        {
                            
SendClientMessage(playeridCOLOR_WHITE"You can't suspect cops!");
                            return 
1;
                        }
                        if(
money 10)
                        {
                            
SendClientMessage(playeridCOLOR_WHITE"Wanted Level must be between 1 and 10 !");
                            return 
1;
                        }
                        if(
money == 0)
                        {
                            
SendClientMessage(playeridCOLOR_WHITE"Wanted Level must be between 1 and 6 !");
                            return 
1;
                        }
                        new 
string1[128];
                        
GetPlayerName(playagiveplayersizeof(giveplayer));
                        
GetPlayerName(playeridsendernamesizeof(sendername));
                        
WantedLevel[playa] = money;
                        
SetPlayerWantedLevel(playamoney);
                        
format(stringsizeof(string), "You've commited a Crime ( %s ). Reporter: %s.",result,sendername);
                        
SendClientMessage(playaCOLOR_LIGHTREDstring);
                        
format(string1sizeof(string1), "Current Wanted Level: %d"money);
                        
SendClientMessage(playaCOLOR_YELLOWstring1);
                        for(new 
0MAX_PLAYERSi++)
                        {
                            if(
IsPlayerConnected(i))
                            {
                                if(
PlayerInfo[i][pMember] == 1||PlayerInfo[i][pLeader] == 1||PlayerInfo[i][pMember] == 2||PlayerInfo[i][pLeader] == 2||PlayerInfo[i][pMember] == 3||PlayerInfo[i][pLeader] == 3)
                                {
                                    
format(stringsizeof(string), "HQ: All Units APB: Reporter: %s",sendername);
                                    
SendClientMessage(iTEAM_BLUE_COLORstring);
                                    
format(stringsizeof(string), "HQ: Crime: %s, Suspect: %s, WantedLevel: %d",result,giveplayer,money);
                                    
SendClientMessage(iTEAM_BLUE_COLORstring);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_WHITE"You are not a Cop !");
            }
        }
        return 
1;
    } 
Reply
#3

thank you verry much i have searched this command for like 2 months
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)