Car help. - 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: Car help. (
/showthread.php?tid=127554)
Car help. -
RoneyRemington - 13.02.2010
Ok. So i was told to put this into my script and it gives me 12 errors and alot of warnings. Why didnt it work?
//top of script
new car;
//OnGameModeInit
car = CreateVehicle(..); // or AddStaticVehicle
//OnPlayerEnterVehicle
if(vehicleid == car)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof name);
if(strcmp(name, "desired name here", true) != 0)
{
RemovePlayerFromVehicle(playerid);
}
}
Re: Car help. -
LiDeRu`s - 13.02.2010
use this...
pawn Код:
new admincar;
public OnGameModeInit()
{
admincar = AddStaticVehicle(ID,x,y,z,233.9429,1,62); // Vehicle
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(newstate == PLAYER_STATE_DRIVER)
{
new Vehicle = GetPlayerVehicleID(playerid);
if(Vehicle == admincar)
{
if(strcmp(PlayerName,"Name Player",true))
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, 0x33AA33AA, "text");
}
}
}
return 1;
}
Re: Car help. -
RoneyRemington - 13.02.2010
ok im kinda new to scripting. what do i change?
EDIT: NVM i got pawno to accept the code. testing now
Re: Car help. -
RoneyRemington - 13.02.2010
ok i got pawno to accept the codes. no errors or warnings. just when im in game i can enter those cars and its not my name. im logged in rcon admin and am admin on the server. would that make a difference?
Re: Car help. -
aNdReSkKkK - 13.02.2010
if(strcmp(PlayerName,"Name Player",true))
did u change that "Name Player" for your username?
Re: Car help. -
RoneyRemington - 14.02.2010
ohh. duh. thanks
Re: Car help. -
RoneyRemington - 14.02.2010
tht didnt work. anything else? i have it completely done. no errors or warnings. how do you put in the pawno code so i can show it?
Re: Car help. -
aNdReSkKkK - 14.02.2010
Код:
if(Vehicle == admincar)
{
That will check only 1 car, created as admincar.. if u say u have many cars that shouldnt work for the others

unless u create admincar1 admincar2, etc then check each on new state driver
Re: Car help. -
RoneyRemington - 14.02.2010
ok i have like 100 cars in it. i use tht command with Roney_Remington. it doesnt make all the cars witht tht name locked for someone else?
Re: Car help. -
aNdReSkKkK - 14.02.2010
and how r u checking the 100 car ids?

or u are just checking 1 car id?