Cuff -
YanLanger - 22.09.2014
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"
Re: Cuff -
MrCallum - 22.09.2014
new IsPlayerPolice;
+Rep if i helped!
Re: Cuff -
Eth - 22.09.2014
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;
Re: Cuff -
YanLanger - 22.09.2014
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.
Re: Cuff -
Eth - 22.09.2014
at the top of your script:
pawn Код:
#define MAX_PLAYERS maximum slots
example, my server have about 500 player slots:
make sure you put it after the includes not before it.
Re: Cuff -
YanLanger - 22.09.2014
Код:
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.
Re: Cuff -
Eth - 22.09.2014
make sure you put the new IsPlayerPolice[MAX_PLAYERS]; after the includes. and delete the #define MAX_PLAYERS
that I gave to you
Re: Cuff -
YanLanger - 22.09.2014
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.
Re: Cuff -
Eth - 22.09.2014
delete the #define MAX_PLAYERS from your gamemode
we won't need it
Re: Cuff -
YanLanger - 22.09.2014
No erros, Now let's go test it :P