SA-MP Forums Archive
making a car admin only - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: making a car admin only (/showthread.php?tid=40992)



making a car admin only - killer__577 - 24.06.2008

ok. kinda confussing but here i go

i would like to have a admin car. i have it on the map i want to be locked now. so only admins can get in. theres 3 cars todo. but if you do one i can normally pick up what you did and do my self.

Код:
AddStaticVehicle(432,2498.4121,-1682.8055,13.4020,8.7251,43,0); // tank1
thats the code. of where itis and crap so now i need it to be admin lvl 5 and locked for every one eals tho they can still see it


Re: making a car admin only - Homerman - 24.06.2008

Код:
new car;
public OnGameModeInit:

Код:
car = AddStaticVehicle(432,2498.4121,-1682.8055,13.4020,8.7251,43,0); // tank1
public OnPlayerEnterVehicle:

Код:
if(vehicleid == car)
{
 if(!IsPlayerAdmin(playerid))
 {
 RemovePlayerFromVehicle(playerid);
 SendClientMessage(playerid,COLOR_***,"[!] Only admin can use this vehicle!");
 }else{
 SendClientMessage(playerid,COLOR_***,"[!] Welcome in Admin vehicle!");
}
}
You mean this? If you want lvl 5, replace "IsPlayerAdmin" with something (for example: if(AdminLvl[playerid] >= 5) ...)


Re: making a car admin only - Fiume - 24.06.2008

Can you make this but only for Nick Jon_Carrey


Re: making a car admin only - killer__577 - 24.06.2008

thanks


Re: making a car admin only - boemeles - 24.06.2008

Quote:
Originally Posted by Fiume
Can you make this but only for Nick Jon_Carrey
new name[32];
GetPlayerName(playerid, name, sizeof(name));
if(strcmp("Jon_Carrey", name, true) == 0)
{
//the code here
}

here you go


Re: making a car admin only - Zh3r0 - 24.06.2008

Код:
new name[32];
GetPlayerName(playerid, name, sizeof(name));
if(strfind("Jon_Carrey", name, true) == 0)
{
  //the code here
}
maybe that strcmp should be strfind


Re: making a car admin only - Eraz0r - 24.06.2008

Why it should be strfind?

strcmp compares 2 strings and check if they are the same.


Re: making a car admin only - boemeles - 24.06.2008

Quote:
Originally Posted by [DSK
Zh3r0 ]
Код:
new name[32];
GetPlayerName(playerid, name, sizeof(name));
if(strfind("Jon_Carrey", name, true) == 0)
{
  //the code here
}
maybe that strcmp should be strfind
it doesn't matter, it works


Re: making a car admin only - Zh3r0 - 24.06.2008

Aha, so, strcmp is like strfind right?


Re: making a car admin only - boemeles - 24.06.2008

i believe its this way:
strcmp (compare) checks the whole string
strfind (find) search if a string has a other string in it