Class Problem. - 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: Class Problem. (
/showthread.php?tid=305605)
Class Problem. -
V_LOPE - 23.12.2011
I have Problem with My Class....
"I have Solider and Engineer Class"
and I want Both Class Can Drive Tanks.
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
new EngCheck = GetVehicleModel(GetPlayerVehicleID(playerid));
if(EngCheck == 432)
if (Solider[playerid] == 0 || Eng[playerid] == 0)
{
SendClientMessage(playerid, COLOR_RED, " You Need Solider/Engineer To Drive Tanks");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
But..when I'm Solider I Can't Drive Tank.
Message " You Need Solider/Engineer To Drive Tanks"
what's the problem?
Re: Class Problem. -
[ABK]Antonio - 23.12.2011
new bool:Solider[MAX_PLAYERS] = false;
^ what i would use
Anyway...Are their Solider and Eng set correctly, also;
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
{
new EngCheck = GetVehicleModel(GetPlayerVehicleID(playerid));
if(EngCheck == 432)
{
if(Solider[playerid] == 0 || Eng[playerid] == 0)
{
SendClientMessage(playerid, COLOR_RED, " You Need Solider/Engineer To Drive Tanks");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
EDIT: here's what i mean by bool instead
pawn Код:
new bool:isSoldier[MAX_PLAYERS] = false,
bool:isEng[MAX_PLAYERS] = false;
//Then you'd just isSoldier[playerid] = true; same with eng
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
{
new EngCheck = GetVehicleModel(GetPlayerVehicleID(playerid));
if(EngCheck == 432)
{
if(Soldier[playerid] == false || Eng[playerid] == false)
{
SendClientMessage(playerid, COLOR_RED, " You Need Solider/Engineer To Drive Tanks");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
Re: Class Problem. -
V_LOPE - 23.12.2011
Quote:
Originally Posted by [ABK]Antonio
new bool:Solider[MAX_PLAYERS] = false;
^ what i would use
Anyway...Are their Solider and Eng set correctly, also;
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate) { if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) { new EngCheck = GetVehicleModel(GetPlayerVehicleID(playerid)); if(EngCheck == 432) { if(Solider[playerid] == 0 || Eng[playerid] == 0) { SendClientMessage(playerid, COLOR_RED, " You Need Solider/Engineer To Drive Tanks"); RemovePlayerFromVehicle(playerid); } } } return 1; }
|
but if I'm (Solider or Engineer) that Message show again.
Re: Class Problem. -
[ABK]Antonio - 23.12.2011
Quote:
Originally Posted by V_LOPE
but if I'm (Solider or Engineer) that Message show again.
|
Then the vars probably aren't set correctly for them...