10.05.2012, 09:45
pawn Code:
enum { Soldier, Sniper, Engineer, JetTrooper, Pilot, Spy };
enum PlayerInfo { Team };
new Info[MAX_PLAYERS][PlayerInfo];
//So instead of #define a hundred times, a simple enum..and an info array instead of a gPlayerClass array.
//This way they can put Kills etc into that single array instead of making a new one.
if(!strcmp(cmdtext, "/jetpack", true))
{
if(Info[playerid][Team] != JetTrooper) return SendClientMessage(playerid, 0xCC0000AA, "You aren't a Jet Trooper!");
SetPlayerSpecialAction(playerid,2);
return 1;
}
//or
CMD:jetpack(playerid, params[])
{
if(Info[playerid][Team] != JetTrooper) return SendClientMessage(playerid, 0xCC0000AA, "You aren't a Jet Trooper!");
SetPlayerSpecialAction(playerid,2);
return 1;
}
//That's an example on what I mean by a different array
pawn Code:
if(GetVehicleModel(vehicleid) == 425 && gPlayerClass[playerid] == SOLDIER && gPlayerClass[playerid] == SNIPER && gPlayerClass[playerid] == ENGINEER && gPlayerClass[playerid] == JETROOPER && gPlayerClass[playerid] == SPY)//if player is pilot then he can drive
{
SendClientMessage(playerid, COLOR_RED, "You Need to be a Pilot to fly Hunter");//messages goes to the player that he can't drive the hunter
RemovePlayerFromVehicle(playerid);//get u off from the hunter
}
//can be
if(Info[playerid][Team] != Pilot && GetVehicleModel(vehicleid) == 425)
{
SendClientMessage(playerid, COLOR_RED, "You Need to be a Pilot to fly Hunter");
RemovePlayerFromVehicle(playerid);
}
pawn Code:
if(something) //if this isn't found THEN
else if(somethingelse) //we check this, if it isn't found
else if(somethingelseagain) //we check this
else //if nothing is found above, we do this
pawn Code:
if(something) //ok we found this
if(somethingelse) //we found this too, so we run it
if(blahblah) //we found this so we're still gonna do it
https://sampwiki.blast.hk/ look around there...