SA-MP Forums Archive
Need help with this code.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with this code.. (/showthread.php?tid=578662)



Need help with this code.. - muzammilfreeman - 21.06.2015

Код:
CMD:aduty(playerid, params[]) {
	new string[128];
    if((PlayerInfo[playerid][pAdmin] >= 2) && GetPVarInt(playerid, "IsInArena") < 0 && !GetPVarInt(playerid, "EventToken")) {
		if(PlayerInfo[playerid][pAdminDuty]) {
			PlayerInfo[playerid][pAdminDuty] = 0;
			PlayerInfo[playerid][pTogReports] = 1;
			//SetPlayerToTeamColor(playerid);
			SendClientMessageEx(playerid, COLOR_WHITE, "You have clocked out from Admin Duty, you are now in Role Play Mode.");
			format(string, sizeof(string), "{AA3333}Admin Duty{FFFF00}: %s has clocked off and is now off duty.", GetPlayerNameEx(playerid));
			ABroadCast(COLOR_YELLOW,string, 2);
		}
		else {
			PlayerInfo[playerid][pAdminDuty] = 1;
			PlayerInfo[playerid][pTogReports] = 0;
			//SetPlayerToTeamColor(playerid);
			SendClientMessageEx(playerid, COLOR_WHITE, "You have clocked in to Admin Duty, you are no longer in Role play Mode.");
			format(string, sizeof(string), "{AA3333}Admin Duty{FFFF00}: %s has clocked in and is now on duty.", GetPlayerNameEx(playerid));
			ABroadCast(COLOR_YELLOW,string, 2);
		}
	}
	return 1;
}

CMD:eaduty(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] != 99999) return 1;
	if(PlayerInfo[playerid][pAdminDuty] != 2) {
	    SendClientMessageEx(playerid, -1, "You are now on EAdmin Duty.");
	    PlayerInfo[playerid][pAdminDuty] = 2;
	}
	else {
	    SendClientMessageEx(playerid, -1, "You are no longer on EAdmin Duty.");
	    PlayerInfo[playerid][pAdminDuty] = 1;
	}
	return 1;
}
Guys i've made this code and added to my gamemode, but after compiling it i get this error. Can someone help me to resolve it?

Error:
Код:
DGRP.pwn(55572) : error 017: undefined symbol "pAdminDuty"
DGRP.pwn(55572) : error 017: undefined symbol "pAdminDuty"
DGRP.pwn(55572) : error 017: undefined symbol "pAdminDuty"
DGRP.pwn(55572) : error 017: undefined symbol "pAdminDuty"
DGRP.pwn(55572) : error 017: undefined symbol "pAdminDuty"
DGRP.pwn(55572) : error 017: undefined symbol "pAdminDuty"



Re: Need help with this code.. - Dusan01 - 21.06.2015

u need to add pAdminDuty in your enum pInfo


Re: Need help with this code.. - UltraScripter - 21.06.2015

pawn Код:
enum example
{
     pAdminDuty
}
new PlayerInfo[MAX_PLAYERS][example];



Re: Need help with this code.. - Ritzy2K - 21.06.2015

Add pAdminDuty in the enum at the top...

Edit : late ._.


Re: Need help with this code.. - muzammilfreeman - 21.06.2015

P.S; Resolved it thanks for help..


Re: Need help with this code.. - UltraScripter - 21.06.2015

yes it will


Re: Need help with this code.. - kyriakos587 - 21.06.2015

Yes it will work


Re: Need help with this code.. - Dusan01 - 21.06.2015

Quote:
Originally Posted by muzammilfreeman
Посмотреть сообщение
I added this>>
Код:
enum
{
     pAdminDuty
}
new PlayerInfo[MAX_PLAYERS][example];
Will it work? I added that in my enum..
Sure it will work, dont forget to add onPlayerConnect
PHP код:
PlayerInfo[playerid][pAdminDuty] = 0



Re: Need help with this code.. - Ritzy2K - 21.06.2015

Simply add pAdminDuty in the enum pInfo whats so hard in this?


Re: Need help with this code.. - UltraScripter - 21.06.2015

yes it will work
you dont have to do it like this exacly

pawn Код:
enum example
{
     pAdminDuty
}
new PlayerInfo[MAX_PLAYERS][example];
you can change the example name and the PlayerInfo to your own