need some help
#1

i need help with becomecop command , can somone help to fix this command ?

pawn Код:
if (strcmp("/becomecop", cmdtext, true, 10) == 0)
  {
  if (GetPlayerScore(playerid) >= 600 && GetPlayerSkin(playerid) >= 267)
  {
  SendClientMessage(playerid,0xFFFFFFFF,"You Are Now Cop!");
  SetPlayerSkin(playerid, 267);
  GivePlayerWeapon(playerid, 22, 100);
  GivePlayerWeapon(playerid, 3, 1);
  SetPlayerColor(playerid,COLOR_BLUE);
  }
  else
  {
  SendClientMessage(playerid,0xFFFFFFFF,"You Need Atleast 600 Score Point To Become Cop!");
  }
    else // line 1691
  {
  SendClientMessage(playerid,0xFFFFFFFF,"You Are Already Cop!");
    }
  return 1;
  }
ERRORS

Код:
D:\GTA San Andreas\gamemodes\kfsr2.pwn(1691) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

Here it is, fixed one.
pawn Код:
if (strcmp("/becomecop", cmdtext, true, 10) == 0)
    {
        if (GetPlayerScore(playerid) <= 600) return SendClientMessage(playerid, 0xFFFFFFFF, "You need atleast 600 score to become cop!");
        if (GetPlayerSkin(playerid) == 267) return SendClientMessage(playerid, 0xFFFFFFFF, "You are cop already!");

    SendClientMessage(playerid,0xFFFFFFFF,"You Are Now Cop!");
    SetPlayerSkin(playerid, 267);
    GivePlayerWeapon(playerid, 22, 100);
    GivePlayerWeapon(playerid, 3, 1);
    SetPlayerColor(playerid,COLOR_BLUE);
    return 1;
  }
Reply
#3

Thank You Very Much It Helped
Reply
#4

but i want to get it random skins


pawn Код:
new becomecop[][] = {
"265",
"266",
"267",
"280",
"281",
"285",
"288",
"282",
"283"
};

SetPlayerSkin(playerid, becomecop[random(sizeof(becomecop))]);
ERROR:

Код:
D:\GTA San Andreas\gamemodes\kfsr2.pwn(1693) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#5

You should do it like this:

Before Main:
pawn Код:
new CopSkins[] = {265, 266, 267, 280, 281, 286, 288, 282, 283};
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/becomecop", cmdtext, true, 10) == 0)
    {
        if (GetPlayerScore(playerid) <= 600) return SendClientMessage(playerid, 0xFFFFFFFF, "You need atleast 600 score to become cop!");
        if (GetPlayerSkin(playerid) == CopSkins[playerid]) return SendClientMessage(playerid, 0xFFFFFFFF, "You are cop already!");

    SendClientMessage(playerid,0xFFFFFFFF,"You Are Now Cop!");
    new rand = random(sizeof(CopSkins));
    SetPlayerSkin(playerid, CopSkins[rand]);
    GivePlayerWeapon(playerid, 22, 100);
    GivePlayerWeapon(playerid, 3, 1);
    SetPlayerColor(playerid,0xFFFFFFFF);
    return 1;
  }
    return 0;
}
Just ask if you got another questions.
Reply
#6

if i use /becomecop few times then it let changes skin and changes random skins ,

says You Are Cop Already and changes my skin and gives weapons ,

Код:
if (GetPlayerSkin(playerid) == CopSkins[playerid]) return SendClientMessage(playerid, 0xFFFFFFFF, "You are cop already!");
Reply
#7

is there a way to change this ?
Reply
#8

Yes, it had one bug.

But, i suggest you to create some team system to your gamemode (for instance using gTeam).
It would allow you to make many teams easily.

Anyways, heres the fixed one.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/becomecop", cmdtext, true, 10) == 0)
    {
        if (GetPlayerScore(playerid) <= 600) return SendClientMessage(playerid, 0xFF0000FF, "You need atleast 600 score to become cop!");
        new skin = GetPlayerSkin(playerid);
        if (skin == 265 || skin == 266 || skin == 267 || skin == 280 || skin == 281 || skin == 286 || skin == 288 || skin == 282 || skin == 283) return SendClientMessage(playerid, 0xFF0000FF, "Error: You are cop already.");

        SendClientMessage(playerid, 0xAFAFAFAA, "You are now cop");
    new rand = random(sizeof(CopSkins));
    SetPlayerSkin(playerid, CopSkins[rand]);
    GivePlayerWeapon(playerid, 22, 100);
    GivePlayerWeapon(playerid, 3, 1);
    SetPlayerColor(playerid,0xFFFFFFFF);
    return 1;
  }
    return 0;
}
Reply
#9

thank you but i dont like to use these gteam things
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)