Originally Posted by [ABK]Antonio
pawn Code:
new isReserved[MAX_PLAYERS]; //Add this at the top of your script.
pawn Code:
new adios1car = CreateVehicle() //fill it in yourself public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); if(GetPlayerVehicleID(playerid) == adios1car && strfind(name(playerid), "adios1", true) == -1) { new Float:X,Float:Y,Float:Z; SendClientMessage(playerid, COLOR_RED, "You can't drive this car!!"); SetPlayerPos(playerid, X,Y,Z+5); } } }
pawn Code:
CMD:callmycar(playerid, params[]) { if(isReserved[playerid] == 1) { new Float:X,Float:Y,Float:Z, name[MAX_PLAYER_NAME]; if(strfind(name(playerid), "adios1", true) != -1) { GetPlayerPos(playerid, X,Y,Z); SetVehiclePos(adios1car, X+3, Y+3, Z); } } else return SendClientMessage(playerid, COLOR_RED, "Your name isn't on the reserved list."); return 1; }
pawn Code:
public OnPlayerConnect(playerid) { if(strfind(name(playerid), "adios1", true) != -1) { isReserved[playerid] = 1; } else isReserved[playerid] = 0; }
|