02.04.2011, 20:07
What faster or better?
PVars or arrays like PlayerInfo[MAX_PLAYERS][pInfo] ...?
PVars or arrays like PlayerInfo[MAX_PLAYERS][pInfo] ...?
SetPVarInt(playerid, "Mony", GetPlayerMoney(playerid));
new cash = GetPVarInt(playerid, "Money");
enum TPlayerData
{
PlayerMoney, // Holds the money of this player
PlayerScore // Holds the score of this player
}
new APlayerData[MAX_PLAYERS][TPlayerData];
APlayerData[playerid][PlayerMony] = 5000;
stock PutPlayerInArena(playerid) {
// This function was created for the purpose of this thread.
SetPlayerPos(playerid, 0, 0, 0);
SetPlayerInterior(playerid, 0);
SetPVarInt(playerid, "Arena", 1);
return 1;
}
CMD:sawnoff(playerid, params[]) {
if(GetPVarInt(playerid, "Arena") != 0) // We're tracking if the player is in the arena. If a PVar doesn't exist, it'll return 0.
return SendClientMessage(playerid, 0, "You can't do this while you're in the arena!");
// Giving the player a sawn-off shotgun with 500 ammo (example from wiki)
GivePlayerWeapon(playerid, 26, 500);
return 1;
}