Scripting Help please!
#3

Quote:
Originally Posted by [ABK]Antonio
View Post
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;
}
thanks for this bud! ill try this one
Reply


Messages In This Thread
Scripting Help please! - by adios1 - 08.12.2011, 10:53
Re: Scripting Help please! - by [ABK]Antonio - 08.12.2011, 11:10
Re: Scripting Help please! - by adios1 - 08.12.2011, 11:19
Re: Scripting Help please! - by adios1 - 08.12.2011, 11:27
Re: Scripting Help please! - by [ABK]Antonio - 08.12.2011, 11:30
Re: Scripting Help please! - by adios1 - 08.12.2011, 11:32
Re: Scripting Help please! - by [ABK]Antonio - 08.12.2011, 11:33
Re: Scripting Help please! - by adios1 - 08.12.2011, 11:40
Re: Scripting Help please! - by adios1 - 08.12.2011, 12:03
Re: Scripting Help please! - by Rob_Maate - 08.12.2011, 12:07

Forum Jump:


Users browsing this thread: 3 Guest(s)