Few Scripting questions.
#1

Simply made this topic so i dont have to make multiple ones, as i need help, or need a question answered i'll update this thread hopefully to get help. For this Badge Command, how would i make it so when im on duty, i type /badge aand my player color turns white, but if i type /badge again, my color turns back to Blue. Identifying me as on duty?

GivePlayerWeapon [X]Solved
Badge Command[]Pending

pawn Код:
CMD:badge(playerid, params[])
{
        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
        {
        SetPlayerColor(playerid, COLOR_WHITE);
        SendClientMessage(playerid, 0x2641FEAA, "[True:RP]You will now be identified as being undercover/off duty.");
        return 1;
        }
        else return SendClientMessage(playerid, COLOR_RED,"[True:RP]Only Government Officials Can Hide Their Badges. ");
}
So how do i make the pepperspray ammo unlimited?
Reply
#2

Just type in 99999999.
Reply
#3

Thanks Crute, updated Thread/Question
Reply
#4

Top Of Script:
pawn Код:
new OnDuty[MAX_PLAYERS]
Command:
pawn Код:
CMD:badge(playerid, params[])
{
        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
        {
                if(OnDuty[playerid] == 1);
                {
                        SetPlayerColor(playerid, COLOR_WHITE);
                        SendClientMessage(playerid, 0x2641FEAA, "[True:RP]You will now be identified as being undercover/off duty.");
                        OnDuty[playerid] = 0;
                        return 1;
                }
                else if(OnDuty[playerid] == 0);
                {
                        SetPlayerColor(playerid, COLOR_BLUE);
                        SendClientMessage(playerid, 0x2641FEAA, "[True:RP]You will now be identified as being on duty.");
                        OnDuty[playerid] = 1;
                        return 1;
                }
        }
        else return SendClientMessage(playerid, COLOR_RED,"[True:RP]Only Government Officials Can Hide Their Badges. ");
        return 1;
}
pawn Код:
OnPlayerConnect(playerid)
{
        OnDuty[playerid] = 0;
        return 1;
}
OnPlayerDisconnect(playerid, reason)
{
        OnDuty[playerid] = 0;
        return 1;
}
Reply
#5

pawn Код:
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(91) : warning 201: redefinition of constant/macro (symbol "CMD:%1(%2)")
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(765) : error 036: empty statement
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(772) : warning 225: unreachable code
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(772) : error 029: invalid expression, assumed zero
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(772) : warning 215: expression has no effect
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(772) : error 001: expected token: ";", but found "if"
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(772) : error 036: empty statement
C:\Users\Tab\Desktop\True Roleplay [0.3c]\True Roleplay [0.3c]\gamemodes\TRP.pwn(772) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.
pawn Код:
CMD:badge(playerid, params[])
{
        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
        {
                if(OnDuty[playerid] == 1);//line 765
                {
                        SetPlayerColor(playerid, COLOR_WHITE);
                        SendClientMessage(playerid, 0x2641FEAA, "[True:RP]You will now be identified as being undercover/off duty.");
                        OnDuty[playerid] = 0;
                        return 1;
                }
                else if(OnDuty[playerid] == 0);//line 772
                {
                        SetPlayerColor(playerid, COLOR_BLUE);
                        SendClientMessage(playerid, 0x2641FEAA, "[True:RP]You will now be identified as being on duty.");
                        OnDuty[playerid] = 1;
                        return 1;
                }
        }
        else return SendClientMessage(playerid, COLOR_RED,"[True:RP]Only Government Officials Can Hide Their Badges. ");
        return 1;
}
Reply
#6

lol im a noob here is the fixed code i think u will have no problem here
pawn Код:
CMD:badge(playerid, params[])
{
        if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
        {
                if(OnDuty[playerid] == 1)//line 765
                {
                        SetPlayerColor(playerid, COLOR_WHITE);
                        SendClientMessage(playerid, 0x2641FEAA, "[True:RP]You will now be identified as being undercover/off duty.");
                        OnDuty[playerid] = 0;
                        return 1;
                }
                else if(OnDuty[playerid] == 0)//line 772
                {
                        SetPlayerColor(playerid, COLOR_BLUE);
                        SendClientMessage(playerid, 0x2641FEAA, "[True:RP]You will now be identified as being on duty.");
                        OnDuty[playerid] = 1;
                        return 1;
                }
        }
        else return SendClientMessage(playerid, COLOR_RED,"[True:RP]Only Government Officials Can Hide Their Badges. ");
        return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)