#1

Ok so i made cuff command

Код:
CMD:cuff(playerid,params[])
{
  new targetid;
  if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /cuff [Part of Name/Player ID]");
  if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF,"{ff0000}ERROR: That Player Is Not Connected!");
  if(playerid == 0) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You can't cuff yourself!");
  if(!IsPlayerPolice(target))
	return SendClientMessage(playerid, -1, "{ff0000}ERROR: Only cops can use this command!");
  {

	   new Float:x, Float:y, Float:z;
	   GetPlayerPos(playerid, x,y,z);
	   if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))
	   {
	    new str[512];
        new name[MAX_PLAYER_NAME];
		GetPlayerName(playerid, name,sizeof(name));
		new target[MAX_PLAYER_NAME];
		GetPlayerName(targetid, target, sizeof(target));
		format(str, sizeof(str), "{ff0000}You cuffed %s!",target);
		SendClientMessage(playerid, 0xE01B1B, str);
        SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);
		SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);
		return 1;
	   }
	}
  return 0;
}
But i get this
pawn Код:
error 017: undefined symbol "IsPlayerPolice"
Reply
#2

new IsPlayerPolice;

+Rep if i helped!
Reply
#3

Quote:
Originally Posted by MrCallum
Посмотреть сообщение
new IsPlayerPolice;

+Rep if i helped!
Don't ask for rep.

pawn Код:
new IsPlayerPolice[MAX_PLAYERS];
and delete your current command and put this:
pawn Код:
CMD:cuff(playerid,params[])
{
  new targetid;
  if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "USAGE: /cuff [Part of Name/Player ID]");
  if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0xFFFFFFF,"{ff0000}ERROR: That Player Is Not Connected!");
  if(playerid == 0) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You can't cuff yourself!");
  if(!IsPlayerPolice[playerid])
    return SendClientMessage(playerid, -1, "{ff0000}ERROR: Only cops can use this command!");

       new Float:x, Float:y, Float:z;
       GetPlayerPos(playerid, x,y,z);
       if(IsPlayerInRangeOfPoint(targetid, 5.0, x, y, z))
       {
        new str[512];
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name,sizeof(name));
        new target[MAX_PLAYER_NAME];
        GetPlayerName(targetid, target, sizeof(target));
        format(str, sizeof(str), "{ff0000}You cuffed %s!",target);
        SendClientMessage(playerid, 0xE01B1B, str);
        SetPlayerAttachedObject(targetid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977,-81.700035, 0.891999, 1.000000, 1.168000);
        SetPlayerSpecialAction(targetid,SPECIAL_ACTION_CUFFED);
        return 1;
       }
  return 1;
}
this would work
also I think you should replace return 0; to return 1;
and when a player chooses cops team or something do this:
pawn Код:
IsPlayerPolice[playerid] = 1;
Reply
#4

EDIT:
Код:
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\CpsNrbrs.pwn(24) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\CpsNrbrs.pwn(24) : error 009: invalid array size (negative, zero or out of bounds)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#5

at the top of your script:
pawn Код:
#define MAX_PLAYERS maximum slots
example, my server have about 500 player slots:
pawn Код:
#define MAX_PLAYERS 500
make sure you put it after the includes not before it.
Reply
#6

Код:
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\CpsNrbrs.pwn(24) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\CpsNrbrs.pwn(24) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\CpsNrbrs.pwn(26) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYERS")
C:\Users\yan\Desktop\Cops And Robbers\pawno\include\a_samp.inc(30) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYERS")
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\CpsNrbrs.pwn(293) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#7

make sure you put the new IsPlayerPolice[MAX_PLAYERS]; after the includes. and delete the #define MAX_PLAYERS
that I gave to you
Reply
#8

ty but now dis left
Код:
C:\Users\yan\Desktop\Cops And Robbers\gamemodes\CpsNrbrs.pwn(25) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYERS")
C:\Users\yan\Desktop\Cops And Robbers\pawno\include\a_samp.inc(30) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYERS")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
Reply
#9

delete the #define MAX_PLAYERS from your gamemode we won't need it
Reply
#10

No erros, Now let's go test it :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)