Player variables dont reset
#1

Hi guys, i have problem with player variables. When player connect his variable sets to 0 and when he disconnect also set to 0, and for example hes variable is 925 and that player disconect now, and when another player connect with that id his variable sets like on that player(925)?
Reply
#2

Show how you did it then lol
Reply
#3

Yeah show the codes
Reply
#4

at the top of GM:
Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS 200
new aduty[MAX_PLAYERS];
on player connect and disconnect:
Код:
aduty[playerid] = 0;
and that is variable for admin duty, and my sererver have 80-120 players and i connect to server as admin and i try /aduty and aduty only active when aduty is 0 and deactive when is 1, and when i type /aduty it dont response like that variable is seted to 0 or 1...
Reply
#5

Show us the aduty command script
Reply
#6

Код:
CMD:aduty(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, GRAD2, "{07C1F5}{FFFFFF} Nisi ovlascen!");
if(aduty[playerid] == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 5)
{
new astring[126];
format(astring, sizeof(astring), "{07C1F5}{FFFFFF}Admin {07C1F5}%s {FFFFFF}Je sada na admin duznosti!",GetName(playerid));
ABroadCast(-1, astring, 4);
aduty[playerid] = 1;
SetPlayerColor(playerid, 0xFF0000FF);
SetPlayerSkin(playerid, 294);
return 1;
}
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new astring[126];
format(astring, sizeof(astring), "{07C1F5}{FFFFFF}Admin {07C1F5}%s {FFFFFF}Je sada na admin duznosti!",GetName(playerid));
ABroadCast(-1, astring, 4);
aduty[playerid] = 1;
SetPlayerColor(playerid,0xFF0000FF);
SetPlayerSkin(playerid, 294);
return 1;
}
return 1;
}
if(aduty[playerid] == 1)
{
new astring[126];
format(astring, sizeof(astring), "{07C1F5}{FFFFFF}Admin {07C1F5}%s {FFFFFF}Vise nije na duznosti!",GetName(playerid));
ABroadCast(-1, astring, 4);
aduty[playerid] = 0;
SetPlayerColor(playerid,COLOR_GRAD2);
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
return 1;
}
return 1;
}
Reply
#7

You just need to do aduty[playerid] = 0; under OnPlayerDisconnect..
Reply
#8

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
You just need to do aduty[playerid] = 0; under OnPlayerDisconnect..
Yes i did that, but still sometims get bugged.... :/
Reply
#9

There's a difference between PVars and normal arrays! Your title is misleading.

Quote:
Originally Posted by Dusan01
Посмотреть сообщение
Yes i did that, but still sometims get bugged.... :/
If you set it EXPLICITLY to 0 under OnPlayerDisconnect, there is no way it can automatically be set to another value when a player connects, unless your script itself sets it. Add prints to debug.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)