What's Wrong? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What's Wrong? (
/showthread.php?tid=376820)
What's Wrong? -
ThePrograme - 11.09.2012
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.
Re: What's Wrong? -
Roach_ - 11.09.2012
They must be decimals:
pawn Код:
new AdminVehicle[][] =
{
{ 425 },
{ 430 },
{ 432 },
{ 520 },
{ 601 }
};
Re: What's Wrong? -
Babul - 11.09.2012
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...
Re: What's Wrong? -
ThePrograme - 11.09.2012
deleted
Re: What's Wrong? -
ThePrograme - 11.09.2012
Thanks Babul it works +rep