Playerinfo
#1

Hey guys.. I tried making a command so that when someone enters it, their faction gets set to faction number '2'.
This is my command:
Код:
CMD:manager(playerid, params[])
{
	PlayerInfo[playerid][pFaction] == 1);
	return 1;
}
BUT I get 2 errors. :/

Errors I get:
Код:
C:\Users\Gabriel\Documents\Coding\Server2\gamemodes\test.pwn(258) : warning 215: expression has no effect
C:\Users\Gabriel\Documents\Coding\Server2\gamemodes\test.pwn(258) : error 001: expected token: ";", but found ")"
C:\Users\Gabriel\Documents\Coding\Server2\gamemodes\test.pwn(258) : error 029: invalid expression, assumed zero
C:\Users\Gabriel\Documents\Coding\Server2\gamemodes\test.pwn(258) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

Just this:

PHP код:
PlayerInfo[playerid][pFaction] = 1
And if you wanna check if the value is 1:

PHP код:
if(PlayerInfo[playerid][pFaction] == 1)
{
    
//Here is it 1
}
else
{
    
//Here not

Reply
#3

I done that ^ It works, but I also done this:
Код:
	if(PlayerInfo[playerid][pFaction] == 0) format(faction, sizeof(faction), "Fighter");
	else if(PlayerInfo[playerid][pFaction] == 1) format(faction, sizeof(faction), "Manager");
	else if(PlayerInfo[playerid][pFaction] == 2) format(faction, sizeof(faction), "Guard");
and this in /stats:

Код:
	format(string, sizeof(string), "Faction: %d", faction);
	SendClientMessage(playerid, -1, string);
and when I do /stats in game, it says Faction: 70
or Faction: 77
Reply
#4

Hello!

%d have to be %s because it is a string.


- Mencent
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)