[HELP] Admin Cars -
DaRkAnGeL[NBK] - 08.10.2011
hey having a few issues around admincars this is what i have admin:
pawn Код:
public OnGameModeInit()
{
new adminbike;
// Don't use these lines if it's a filterscript
SetGameModeText("Gangwar TDM!");
//admin vehicles
adminbike = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,10000); // admin_nrg1
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == adminbike && !IsPlayerAdmin(playerid))
{
ClearAnimations(playerid);
SendClientMessage(playerid, 0xAA3333AA, "This vehicle is for admins only!");
}
return 1;
}
but i get these errors for some reason:
Код:
C:\Users\Unlimited DMers\Desktop\Fas FreeRoam\gamemodes\GWTDM.pwn(61) : warning 204: symbol is assigned a value that is never used: "adminbike"
C:\Users\Unlimited DMers\Desktop\Fas FreeRoam\gamemodes\GWTDM.pwn(131) : error 017: undefined symbol "adminbike"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: [HELP] Admin Cars -
Zonoya - 08.10.2011
put new adminbike; outside of any function
Re: [HELP] Admin Cars -
DaRkAnGeL[NBK] - 08.10.2011
perfect thanks you the speedy reply

you will be credited in script XD
Re: [HELP] Admin Cars -
DaRkAnGeL[NBK] - 08.10.2011
one question if i wanted to add say 10 admin vehicles how would i do this would it be the same?
Re: [HELP] Admin Cars -
Zonoya - 08.10.2011
yeah just do the same at what u just did like
Код:
new [];
new [];
new [];
new [];
public OnGameModeInt
create the cars and do the same :)
Re: [HELP] Admin Cars -
Wesley221 - 08.10.2011
Or just do it like this:
pawn Код:
new AdminVehicles[Amount + 1]; // this will be the global variable, dont remove the +1, otherwise it will give you an error.
// also change 'amount' to the amount of vehicles are for admin only
AdminVehicles[0] = CreateVehicle(....);
AdminVehicles[1] = CreateVehicle(....);
Etc etc
Re: [HELP] Admin Cars -
Zonoya - 08.10.2011
yeah
Re: [HELP] Admin Cars -
DaRkAnGeL[NBK] - 08.10.2011
so under the OnPlayerEnterVehicle if
pawn Код:
new AdminVehicles[10 + 1];
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Gangwar TDM!");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
//grove cars
AddStaticVehicle(439,2488.2041,-1662.5435,13.1441,62.3311,86,86); // grovecar1
AddStaticVehicle(575,2474.6104,-1671.9984,13.1387,45.3853,86,86); // grovecar2
AddStaticVehicle(567,2480.3875,-1698.2565,13.3321,179.3588,86,86); // grovecar3
AddStaticVehicle(461,2473.9429,-1696.2106,13.3232,182.9979,86,86); // grovecar4
//admin vehicles
AdminVehicles[0] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,10000); // admin_nrg1
return 1;
}
then the OnPlayerEnterVehicle would be:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == AdminVehicles[0] && !IsPlayerAdmin(playerid))
{
ClearAnimations(playerid);
GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
}
return 1;
}
correct? anyway thanks guys

both credited and rep given
Re: [HELP] Admin Cars -
Wesley221 - 09.10.2011
Quote:
Originally Posted by DaRkAnGeL[NBK]
so under the OnPlayerEnterVehicle if
pawn Код:
new AdminVehicles[10 + 1];
public OnGameModeInit() { // Don't use these lines if it's a filterscript SetGameModeText("Gangwar TDM!"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); //grove cars AddStaticVehicle(439,2488.2041,-1662.5435,13.1441,62.3311,86,86); // grovecar1 AddStaticVehicle(575,2474.6104,-1671.9984,13.1387,45.3853,86,86); // grovecar2 AddStaticVehicle(567,2480.3875,-1698.2565,13.3321,179.3588,86,86); // grovecar3 AddStaticVehicle(461,2473.9429,-1696.2106,13.3232,182.9979,86,86); // grovecar4 //admin vehicles AdminVehicles[0] = AddStaticVehicleEx(522,2434.1450,-1675.1233,13.4768,181.4236,1,0,10000); // admin_nrg1 return 1; }
then the OnPlayerEnterVehicle would be:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if(vehicleid == AdminVehicles[0] && !IsPlayerAdmin(playerid)) { ClearAnimations(playerid); GameTextForPlayer(playerid,"Admin Vehicle",3000,4); } return 1; }
correct? anyway thanks guys  both credited and rep given
|
That would be loads of work when checking if its an AdminVehicle[#].
Easier way to check it is like this:
pawn Код:
#define ADMINVEHICLES 10 // this will be the amount of admin vehicles you want
new AdminVehicles[ADMINVEHICLES+1]; // change the global variable to this one
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
for( new i = 0; i < sizeof(ADMINVEHICLES); i++ ) // looping through every admin vehicle you made
{
if(vehicleid == AdminVehicles[i] && !IsPlayerAdmin(playerid))
{
ClearAnimations(playerid);
GameTextForPlayer(playerid,"Admin Vehicle",3000,4);
}
}
return 1;
}
Re: [HELP] Admin Cars -
DaRkAnGeL[NBK] - 09.10.2011
Quote:
Originally Posted by Wesley221
That would be loads of work when checking if its an AdminVehicle[#].
Easier way to check it is like this:
pawn Код:
#define ADMINVEHICLES 10 // this will be the amount of admin vehicles you want new AdminVehicles[ADMINVEHICLES+1]; // change the global variable to this one public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { for( new i = 0; i < sizeof(ADMINVEHICLES); i++ ) // looping through every admin vehicle you made { if(vehicleid == AdminVehicles[i] && !IsPlayerAdmin(playerid)) { ClearAnimations(playerid); GameTextForPlayer(playerid,"Admin Vehicle",3000,4); } } return 1; }
|
thanks man i used most of what you both said in my tut on this subject if you wanna check it out then goto :
https://sampforum.blast.hk/showthread.php?tid=288770 also credits to you bro