making a car admin only
#1

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
Reply
#2

Код:
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) ...)
Reply
#3

Can you make this but only for Nick Jon_Carrey
Reply
#4

thanks
Reply
#5

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
Reply
#6

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

Why it should be strfind?

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

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
Reply
#9

Aha, so, strcmp is like strfind right?
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)