Errors on IsPlayerSpawned.
#1

Hello everyone!

I have a little errors here and i have no idea what's wrong.

Here is my command btw i want to do it to all of my commands.. (I mean only /rape /arrest /cuff)

Line

PHP код:
if(!IsPlayerSpawned(playerid)) return SendClientMessage(playeridCOLOR_RED"[ERROR]: You must be spawned to use that command"); 
Define
PHP код:
new IsPlayerSpawned[MAX_PLAYERS]; 
Command

PHP код:
CMD:rape(playerid,params[])
{
  if(
IsPlayerPolice[playerid] != 0) return SendClientMessage(playerid,-1,"{ff0000}Cops are not allowed to rape.");
  new 
targetidFloat:xFloat:yFloat:z;
  if(
sscanf(params"u"targetid)) return SendClientMessage(playerid, -1"USAGE: /rape [Part of name/Player ID]");
  if(
playerid == targetid) return SendClientMessage(playerid, -1"{FF0000}[ERROR]: You can't rape yourself");
  if(!
IsPlayerSpawned(playerid)) return SendClientMessage(playeridCOLOR_RED"[ERROR]: You must be spawned to use that command");// This line <<
  
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid0xFFFFFFF,"{ff0000}[ERROR]: This player is not connected!");
  
GetPlayerPos(playerid,x,y,z);
  if(
IsPlayerInRangeOfPoint(targetid5.0x,y,z))
  {
    new 
str[512];
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridname,sizeof(name));
    new 
target[MAX_PLAYER_NAME];
    
GetPlayerName(targetidtarget,sizeof(target));
    
format(strsizeof(str), "{ff0000}You have raped %s",target);
    
SendClientMessage(playerid0xE01B1Bstr);
    
ApplyAnimation(playerid"MISC""BITCH_SLAP"0,0,0,0,0,0,0);
    }
  return 
1;

Reply
#2

Notice the changes in bold --
Original :-
Quote:

if(!IsPlayerSpawned(playerid))

The correct one -
Quote:

if(!IsPlayerSpawned[playerid])

Use square brackets with arrays
Reply
#3

Quote:
Originally Posted by Stuun
Посмотреть сообщение
Hello everyone!

I have a little errors here and i have no idea what's wrong.

Here is my command btw i want to do it to all of my commands.. (I mean only /rape /arrest /cuff)

Line

PHP код:
if(!IsPlayerSpawned(playerid)) return SendClientMessage(playeridCOLOR_RED"[ERROR]: You must be spawned to use that command"); 
Define
PHP код:
new IsPlayerSpawned[MAX_PLAYERS]; 
Command

PHP код:
CMD:rape(playerid,params[])
{
  if(
IsPlayerPolice[playerid] != 0) return SendClientMessage(playerid,-1,"{ff0000}Cops are not allowed to rape.");
  new 
targetidFloat:xFloat:yFloat:z;
  if(
sscanf(params"u"targetid)) return SendClientMessage(playerid, -1"USAGE: /rape [Part of name/Player ID]");
  if(
playerid == targetid) return SendClientMessage(playerid, -1"{FF0000}[ERROR]: You can't rape yourself");
  if(!
IsPlayerSpawned(playerid)) return SendClientMessage(playeridCOLOR_RED"[ERROR]: You must be spawned to use that command");// This line <<
  
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid0xFFFFFFF,"{ff0000}[ERROR]: This player is not connected!");
  
GetPlayerPos(playerid,x,y,z);
  if(
IsPlayerInRangeOfPoint(targetid5.0x,y,z))
  {
    new 
str[512];
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playeridname,sizeof(name));
    new 
target[MAX_PLAYER_NAME];
    
GetPlayerName(targetidtarget,sizeof(target));
    
format(strsizeof(str), "{ff0000}You have raped %s",target);
    
SendClientMessage(playerid0xE01B1Bstr);
    
ApplyAnimation(playerid"MISC""BITCH_SLAP"0,0,0,0,0,0,0);
    }
  return 
1;

And what's the error?

PD: ah xd
Reply
#4

Thanks brozeus.

Lol, That was fast.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)