What's Wrong?
#1

Ok here is the code:
pawn Код:
new AdminVehicle[][] =
{
    {"425"},
    {"430"},
    {"432"},
    {"520"},
    {"601"}
};

public OnPlayerStateChange(playerid, newstate, oldstate)
{
        if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == AdminVehicle){
        if(!IsPlayerAdmin(playerid))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF0000FF,"Admins only!");}
        }
        return 1;
}
And here is the error:
Код:
C:\Documents and Settings\Ћeljko\Desktop\SA-MP Server\gamemodes\Untitled.pwn(44) : error 033: array must be indexed (variable "AdminVehicle")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

They must be decimals:
pawn Код:
new AdminVehicle[][] =
{
    { 425 },
    { 430 },
    { 432 },
    { 520 },
    { 601 }
};
Reply
#3

those warnings come from the vehicle models used in a string ("430") etc. i got a slightly modified suggestion, using arrays for identifying an admin-vehicle-model:
pawn Код:
new AdminVehicle[622];

//OnGameModeInit
AdminVehicle[425]=1;
AdminVehicle[430]=1;
AdminVehicle[432]=1;
AdminVehicle[520]=1;
AdminVehicle[601]=1;

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(!IsPlayerAdmin(playerid))
    {
        if(newstate == PLAYER_STATE_DRIVER && AdminVehicle[GetVehicleModel(GetPlayerVehicleID(playerid))] == 1)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF0000FF,"Admins only!");
        }
    }
    return 1;
}
not tested, should work nevertheless...
Reply
#4

deleted
Reply
#5

Thanks Babul it works +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)