Help Please
#1

How To Make invaild Command When Admin Aduty ?
please i want example +Rep
PHP код:
CMD:arrest(playeridparams[])
{
        new 
targetid;
        if (
gTeam[playerid] == TEAM_SWAT || gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_FBI)
        if(
sscanf(params"u"targetid)) return SendClientMessage(playerid,COLOR_ERROR,"USAGE: /Arrest (Player Name/PlayerID)");
        new 
Float:xFloat:yFloat:z;
        
GetPlayerPos(targetidxyz);
        if(!
IsPlayerInRangeOfPoint(targetid5.0xyz)) return SendClientMessage(playeridCOLOR_RED"You aren't near that player.");
        if(
GetPlayerWantedLevel(targetid) < 4) return SendClientMessage(playeridCOLOR_RED"That player is not wanted!");
        
SetPlayerInterior(targetid3);
        new 
RandomG random(sizeof(RandomSpawnCLIVINS));
        
SetPlayerPos(targetidRandomSpawnJail[RandomG][0], RandomSpawnJail[RandomG][1], RandomSpawnJail[RandomG][2]);
        
SetPlayerFacingAngle(targetidRandomSpawnJail[RandomG][3]);
        
GivePlayerMoney(playerid1000+random(9000));
        
GivePlayerMoney(targetid1000-random(9000));
        
SetPlayerScore(playeridGetPlayerScore(playerid) + 1);
        
SetPlayerScore(targetidGetPlayerScore(targetid) - 1);
        
SetPlayerHealth(targetid10000000000.0);
        
ApplyAnimationplayerid,"ped""ARRESTgun"4.000000);
        
SetPlayerWantedLevel(targetid0);
        
ResetPlayerWeapons(targetid);
        
//Set player Bail
        
MoneyBail[targetid] = 4000+random(8000);
        new 
bail[24];
        
format(bailsizeof(bail), "%d $"MoneyBail[targetid]);
        
TextDrawSetString(JailTimer4[targetid],bail);
        
//Info
        
new b[128];
        
format(bsizeof(b), "Now you are in jail! You need to pay: %i $"MoneyBail[targetid]);
        
SendClientMessage(targetid, -1b);
        
GameTextForPlayer(targetid"~r~Jailed~y~!"35003);
        
TextDrawShowForPlayer(targetidJailTimer0[targetid]);
        
TextDrawShowForPlayer(targetidJailTimer1[targetid]);
        
TextDrawShowForPlayer(targetidJailTimer2[targetid]);
        
TextDrawShowForPlayer(targetidJailTimer3[targetid]);
        
TextDrawShowForPlayer(targetidJailTimer4[targetid]);
        
PlayerSeconds[targetid] = 20//Here: 60000+random(60000);
        
PlayerTimer[targetid] = SetTimerEx("JailTimer",1000,true,"i",targetid);
        return 
1;

i want made it on this command arrest
and i use this aduty
PHP код:
CMD:aduty(playerid//Doesnt need params function
{
    if(
PlayerInfo[playerid][pRank] >= && PlayerInfo[playerid][pRank] <= || IsPlayerAdmin(playerid)) //If you use rcon admin delete (PlayerInfo[playerid][pAdmin] >=1 ||
    
{
        if (
aDuty[playerid] == 0//Check if player is on duty
        
{
            new 
string[128];
            new 
Float:x,Float:y,Float:z;
            new 
Text3D:label Create3DTextLabel("Admin On Duty!"COLOR_DRED,x,y,z40.000); //Creates 3d text label at player position
            
GetPlayerPos(playerid,x,y,z); //Looks for players position
            
SetPlayerHealth(playerid,999999); //makes player godmode
            
SetPlayerColor(playerid,COLOR_DRED); //set admin colour red
            
SetPlayerSkin(playerid,294); //set admin skin to 294
            
format(string,sizeof(string), "%s is now on Duty!",GetPlayerNameEx(playerid)); //here you format string to send to players
            
SendClientMessageToAll(COLOR_DRED,string); //send string to players
            
SendClientMessage(playerid,COLOR_DRED,"You are now on duty!"); //Tell admin he is now on duty
            
Attach3DTextLabelToPlayer(label,playerid,0.00.00.7); //attach 3d text label made before to player
            
aDuty[playerid] = 1//Set player on duty
        
}
        else if (
aDuty[playerid] == 1//Check if player is on duty
        
{
            new 
string[128];
            new 
Float:x,Float:y,Float:z;
            new 
Text3D:label Create3DTextLabel("Admin On Duty!"COLOR_DRED,x,y,z40.000);
            
Delete3DTextLabel(label); //Delete 3d text label saying "Admin On Duty!"
            
SetPlayerHealth(playerid,100); //sets player health back to 100
            
format(string,sizeof(string)," %s is now off Duty!",GetPlayerNameEx(playerid)); //Format string to send to players
            
SendClientMessageToAll(COLOR_DRED,string); //send players string
            
SendClientMessage(playeridCOLOR_DRED,"You are now off duty!"); //send admin message he is off duty
            
aDuty[playerid] = 0//sets admin off duty
        
}
    }
    else
        
SendClientMessage(playerid,COLOR_DRED,"You are not high level enough!"); //Error message to send to players who arent admins
    
return 1;

Reply
#2

bad Explanation dude .. i swear i dident understand 1word ... explain so wecan help u Good Explanation= Good help
Reply
#3

Its easy

Just add this line :
Код:
if(aDuty[playerid] != 0) return SendClientMessage(palyerid, -1, "Error: You are an admin on duty!");
Код:
CMD:arrest(playerid, params[])
{
        new targetid;
if(aDuty[playerid] != 0) return SendClientMessage(palyerid, -1, "Error: You are an admin on duty!");
        if (gTeam[playerid] == TEAM_SWAT || gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_FBI)
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid,COLOR_ERROR,"USAGE: /Arrest (Player Name/PlayerID)");
        new Float:x, Float:y, Float:z;
        GetPlayerPos(targetid, x, y, z);
        if(!IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z)) return SendClientMessage(playerid, COLOR_RED, "You aren't near that player.");
        if(GetPlayerWantedLevel(targetid) < 4) return SendClientMessage(playerid, COLOR_RED, "That player is not wanted!");
        SetPlayerInterior(targetid, 3);
        new RandomG = random(sizeof(RandomSpawnCLIVINS));
        SetPlayerPos(targetid, RandomSpawnJail[RandomG][0], RandomSpawnJail[RandomG][1], RandomSpawnJail[RandomG][2]);
        SetPlayerFacingAngle(targetid, RandomSpawnJail[RandomG][3]);
        GivePlayerMoney(playerid, 1000+random(9000));
        GivePlayerMoney(targetid, 1000-random(9000));
        SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
        SetPlayerScore(targetid, GetPlayerScore(targetid) - 1);
        SetPlayerHealth(targetid, 10000000000.0);
        ApplyAnimation( playerid,"ped", "ARRESTgun", 4.0, 0, 0, 0, 0, 0);
        SetPlayerWantedLevel(targetid, 0);
        ResetPlayerWeapons(targetid);


        //Set player Bail
        MoneyBail[targetid] = 4000+random(8000);
        new bail[24];
        format(bail, sizeof(bail), "%d $", MoneyBail[targetid]);
        TextDrawSetString(JailTimer4[targetid],bail);

        //Info
        new b[128];
        format(b, sizeof(b), "Now you are in jail! You need to pay: %i $", MoneyBail[targetid]);
        SendClientMessage(targetid, -1, b);
        GameTextForPlayer(targetid, "~r~Jailed~y~!", 3500, 3);

        TextDrawShowForPlayer(targetid, JailTimer0[targetid]);
        TextDrawShowForPlayer(targetid, JailTimer1[targetid]);
        TextDrawShowForPlayer(targetid, JailTimer2[targetid]);
        TextDrawShowForPlayer(targetid, JailTimer3[targetid]);
        TextDrawShowForPlayer(targetid, JailTimer4[targetid]);

        PlayerSeconds[targetid] = 20; //Here: 60000+random(60000);
        PlayerTimer[targetid] = SetTimerEx("JailTimer",1000,true,"i",targetid);
        return 1;
}
Reply
#4

Edit: Guy above already said the answer and we posted on same time. Apologies.
PHP код:
CMD:arrest(playeridparams[])
{
    if(
aDuty[playerid]==1)
    {
        return 
SendClientMessage(playerid, -1"[ERROR]: Bitch please, you are on admin-duty. You cant arrest no bitches now.");
    }
    else
    {
            new 
targetid;
            if (
gTeam[playerid] == TEAM_SWAT || gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_FBI)
            if(
sscanf(params"u"targetid)) return SendClientMessage(playerid,COLOR_ERROR,"USAGE: /Arrest (Player Name/PlayerID)");
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(targetidxyz);
            if(!
IsPlayerInRangeOfPoint(targetid5.0xyz)) return SendClientMessage(playeridCOLOR_RED"You aren't near that player.");
            if(
GetPlayerWantedLevel(targetid) < 4) return SendClientMessage(playeridCOLOR_RED"That player is not wanted!");
            
SetPlayerInterior(targetid3);
            new 
RandomG random(sizeof(RandomSpawnCLIVINS));
            
SetPlayerPos(targetidRandomSpawnJail[RandomG][0], RandomSpawnJail[RandomG][1], RandomSpawnJail[RandomG][2]);
            
SetPlayerFacingAngle(targetidRandomSpawnJail[RandomG][3]);
            
GivePlayerMoney(playerid1000+random(9000));
            
GivePlayerMoney(targetid1000-random(9000));
            
SetPlayerScore(playeridGetPlayerScore(playerid) + 1);
            
SetPlayerScore(targetidGetPlayerScore(targetid) - 1);
            
SetPlayerHealth(targetid10000000000.0);
            
ApplyAnimationplayerid,"ped""ARRESTgun"4.000000);
            
SetPlayerWantedLevel(targetid0);
            
ResetPlayerWeapons(targetid);
            
//Set player Bail
            
MoneyBail[targetid] = 4000+random(8000);
            new 
bail[24];
            
format(bailsizeof(bail), "%d $"MoneyBail[targetid]);
            
TextDrawSetString(JailTimer4[targetid],bail);
            
//Info
            
new b[128];
            
format(bsizeof(b), "Now you are in jail! You need to pay: %i $"MoneyBail[targetid]);
            
SendClientMessage(targetid, -1b);
            
GameTextForPlayer(targetid"~r~Jailed~y~!"35003);
            
TextDrawShowForPlayer(targetidJailTimer0[targetid]);
            
TextDrawShowForPlayer(targetidJailTimer1[targetid]);
            
TextDrawShowForPlayer(targetidJailTimer2[targetid]);
            
TextDrawShowForPlayer(targetidJailTimer3[targetid]);
            
TextDrawShowForPlayer(targetidJailTimer4[targetid]);
            
PlayerSeconds[targetid] = 20//Here: 60000+random(60000);
            
PlayerTimer[targetid] = SetTimerEx("JailTimer",1000,true,"i",targetid);
            return 
1;
        }

Reply
#5

Have Some Problems
When i Off The Aduty He is Cant Arrest Me
And Problem Colour My Old Colour Not Back! its still colour red when i off aduty
please Help+Rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)