[on duty] Command Help
#1

I've been trying to figure my problem out in (I AM SERIOUS NOW) 3-4 hours i can't find it

pawn Код:
dcmd_onduty(playerid, params[])
{
#pragma unused params
if(IsPlayerInRangeOfPoint(playerid, 7.0, 257.1060, 78.4763, 1003.6406)) return 0;
{
if(GetPVarInt(playerid, "Cop") == 0) return SendClientMessage(playerid, COLOR_RED, "You are not a cop!");
else if(GetPVarInt(playerid, "Cop") == 1) return
GivePlayerWeapon(playerid, 3, 1);
GivePlayerWeapon(playerid, 22, 500);
GivePlayerWeapon(playerid, 31, 250);
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid, COLOR_BLUE, "You are now on duty! Go do you job Officer!");
}
return 1;
}
Does any one see the problem?
Reply
#2

try this:
pawn Код:
dcmd_onduty(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 7.0, 257.1060, 78.4763, 1003.6406))
    {
        if(GetPVarInt(playerid, "Cop") == 0) return SendClientMessage(playerid, COLOR_RED, "You are not a cop!");

        if(GetPVarInt(playerid, "Cop") == 1)
        {
            GivePlayerWeapon(playerid, 3, 1);
            GivePlayerWeapon(playerid, 22, 500);
            GivePlayerWeapon(playerid, 31, 250);
            SetPlayerArmour(playerid, 100);
            SendClientMessage(playerid, COLOR_BLUE, "You are now on duty! Go do your job Officer!");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You are not at your locker.");
        return 1;
    }
    return 1;
}
Reply
#3

Код:
dcmd_onduty(playerid, params[])
{
    if(!IsPlayerInRangeOfPoint(playerid, 7.0, 257.1060, 78.4763, 1003.6406)) return SendClientMessage(playerid, COLOR_RED, "You are not at your locker.");
    if(GetPVarInt(playerid, "Cop") < 1) return SendClientMessage(playerid, COLOR_RED, "You are not a cop!");
    GivePlayerWeapon(playerid, 3, 1);
    GivePlayerWeapon(playerid, 22, 500);
    GivePlayerWeapon(playerid, 31, 250);
    SetPlayerArmour(playerid, 100);
    SendClientMessage(playerid, COLOR_BLUE, "You are now on duty! Go do your job Officer!");
    return 1;
}
i guess, thats more effisien
Reply
#4

It Still gives me this

And my "Cop" is set to 1 because the score and cash are working
pawn Код:
if(GetPVarInt(playerid, "Cop") == 0) return SendClientMessage(playerid, COLOR_RED, "You are not a cop!");
Reply
#5

Zdevine your gives me the Cop error message in the locker room, but if im outside it says i am not by your locker wich is good, but the You are not a cop is not good


And Black your gives me the You are not a cop everywhere
Reply
#6

pawn Код:
dcmd_onduty(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(7.0, 257.1060, 78.4763, 1003.6406)) return SendClientMessage(playerid, COLOR_RED, "You are not at your locker.");
if(GetPVarInt(playerid, "Cop") == 0) return SendClientMessage(playerid, COLOR_RED, "You are not a cop!");
if(IsPlayerInRangeOfPoint(7.0, 257.1060, 78.4763, 1003.6406 && GetPVarInt(playerid, "Cop") == 1))
{
GivePlayerWeapon(playerid, 3, 1);
            GivePlayerWeapon(playerid, 22, 500);
            GivePlayerWeapon(playerid, 31, 250);
            SetPlayerArmour(playerid, 100);
            SendClientMessage(playerid, COLOR_BLUE, "You are now on duty! Go do your job Officer!");
          return 1;
        }
return 1;
}
Reply
#7

Stix your code works the best but

Код:
[data]
Pass = 118358421
IP = ***.**.*.***
Cash = 50000
Score = 25
Admin = 1
Moderator = 0
Cop = 1
Criminal = 0
Civilian = 0
That is my Userfile but it still says i am no cop when i do it in the locker room
Reply
#8

do you write from userfile into a pvar on login? because it isnt seeing the 1 loaded into GetPVarInt(playerid, "Cop")
Reply
#9

Код:
forward UserDataLoad_data(playerid,name[],value[]);

public UserDataLoad_data(playerid,name[],value[]) { //This loads the settings from the INI file
    INI_Int("Pass",pInfo[playerid][Pass]);
    INI_String("IP",pIP[playerid],16);
    INI_Int("Admin",pInfo[playerid][Admin]);
    INI_Int("Moderator",pInfo[playerid][Moderator]);
    INI_Int("Cop",pInfo[playerid][Cop]);
    INI_Int("Criminal",pInfo[playerid][Criminal]);
    INI_Int("Civilian",pInfo[playerid][Civilian]);
    INI_Int("Cash",pInfo[playerid][Cash]);
    INI_Int("Score",pInfo[playerid][Score]);
    INI_Int("Banned",pInfo[playerid][Banned]);

    return 1;
}
Reply
#10

why dont u just use playerdata

pawn Код:
dcmd_onduty(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(7.0, 257.1060, 78.4763, 1003.6406)) return SendClientMessage(playerid, COLOR_RED, "You are not at your locker.");
if(PlayerInfo[playerid][Cop] == 0) return SendClientMessage(playerid, COLOR_RED, "You are not a cop!");
if(IsPlayerInRangeOfPoint(7.0, 257.1060, 78.4763, 1003.6406 && PlayerInfo[playerid][Cop] >= 1))
{
GivePlayerWeapon(playerid, 3, 1);
            GivePlayerWeapon(playerid, 22, 500);
            GivePlayerWeapon(playerid, 31, 250);
            SetPlayerArmour(playerid, 100);
            SendClientMessage(playerid, COLOR_BLUE, "You are now on duty! Go do your job Officer!");
          return 1;
        }
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)