SetPlayerCheckpoint?
#1

Hello, I've Tried making a command called /callhelp
work's perfect, only problem is, i cant set it to the police location

So just say i did /callhelp SFPD Need Backup!

It Would set a checkpoint where the officer is
and i only Want The Army to See The Checkpoint
I've Tried doing it and it doesn't work, it sets the checkpoint on the other side of the world
if you could help me please, it would be much appreciated =]

Heres teh code


pawn Код:
if(strcmp(cmdtext, "/callhelp", true, 9) == 0)
  {
      new Float:pX,Float:pY,Float:pZ;
      IsSpawned[playerid] = 1;
      if(!cmdtext[9])return SendClientMessage(playerid, COLOR_RED, "USAGE: /callhelp [location]");
      new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "Officer %s Is Requesting Help! [Location: %s] Respond To His Location Immediately!", str, cmdtext[9]);
        SendClientMessageToArmy(COLOR_GREEN, str);
        if(gTeam[playerid] == TEAM_ARMY)
        {
            SetPlayerCheckpoint(playerid, GetPlayerPos(playerid,pX,pY,pZ));
        }
        SendClientMessage(playerid,COLOR_BLUE,"The Army Has Been Notified Of Your Call, Please Wait At Your Current Location.");
            return 1;
  }
Reply
#2

You need to do a loop, no?


Try this:

pawn Код:
if(strcmp(cmdtext, "/callhelp", true, 9) == 0)
  {
      new Float:pX,Float:pY,Float:pZ;
      IsSpawned[playerid] = 1;
      if(!cmdtext[9])return SendClientMessage(playerid, COLOR_RED, "USAGE: /callhelp [location]");
      new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "Officer %s Is Requesting Help! [Location: %s] Respond To His Location Immediately!", str, cmdtext[9]);
        SendClientMessageToArmy(COLOR_GREEN, str);
        GetPlayerPos(playerid,pX,pY,pZ)
        for(new i=0; i<MAX_PLAYERS; i ++)
        {
          if(gTeam[i] == TEAM_ARMY)
          {
              SetPlayerCheckpoint(i, px, py, pz);
                return 1;
          }
        }
        SendClientMessage(playerid,COLOR_BLUE,"The Army Has Been Notified Of Your Call, Please Wait At Your Current Location.");
  }
EDIT: Ok, should be good now.

EDIT2: Lol. Ok now.
Reply
#3

Quote:
Originally Posted by _❼_
You need to do a loop, no?


Try this:

pawn Код:
if(strcmp(cmdtext, "/callhelp", true, 9) == 0)
  {
      new Float:pX,Float:pY,Float:pZ;
      IsSpawned[playerid] = 1;
      if(!cmdtext[9])return SendClientMessage(playerid, COLOR_RED, "USAGE: /callhelp [location]");
      new str[128];
        GetPlayerName(playerid, str, sizeof(str));
        format(str, sizeof(str), "Officer %s Is Requesting Help! [Location: %s] Respond To His Location Immediately!", str, cmdtext[9]);
        SendClientMessageToArmy(COLOR_GREEN, str);
        GetPlayerPos(playerid,pX,pY,pZ)
        for(new i=0; i<MAX_PLAYERS; i ++)
        {
          if(gTeam[i] == TEAM_ARMY)
          {
              SetPlayerCheckpoint(i, px, py, pz);
                return 1;
          }
        }
        SendClientMessage(playerid,COLOR_BLUE,"The Army Has Been Notified Of Your Call, Please Wait At Your Current Location.");
  }
EDIT: Ok, should be good now.

EDIT2: Lol. Ok now.
Thanks lol But i get this error D:
error 001: expected token: ";", but found "for"

Which is this line

pawn Код:
for(new i=0; i<MAX_PLAYERS; i ++)
D: :P
Reply
#4

^

pawn Код:
GetPlayerPos(playerid,pX,pY,pZ)
        for(new i=0; i<MAX_PLAYERS; i ++)
        {
It's missing a semi-colon after GetPlayerPos' final bracket:

pawn Код:
GetPlayerPos(playerid,pX,pY,pZ);
        for(new i=0; i<MAX_PLAYERS; i ++)
        {
Reply
#5

Lol, my fail. I actually edited that post 4 times .. I guess it should've been 5
Reply
#6

Quote:
Originally Posted by Freddo [BINMAN
]
^

pawn Код:
GetPlayerPos(playerid,pX,pY,pZ)
        for(new i=0; i<MAX_PLAYERS; i ++)
        {
It's missing a semi-colon after GetPlayerPos' final bracket:

pawn Код:
GetPlayerPos(playerid,pX,pY,pZ);
        for(new i=0; i<MAX_PLAYERS; i ++)
        {
Ahh, Thank You Heaps! I Don't Look Hard Enough, Lol Thanks Again. <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)