Personal Car - 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: Personal Car (
/showthread.php?tid=245986)
Personal Car -
Petru_Me - 02.04.2011
Hi ! First sorry for my English . PLease , someone help me with a little problem . I want to add personal cars in my gamemode 0.3c . I tried with new variable; and with car id but both doesn't work . Please help me !
Re: Personal Car -
Sascha - 02.04.2011
this at the top:
at OnGameModeInit:
pawn Код:
pcar = AddStaticVehicle(............);
at "OnPlayerStateChange"
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
new v = GetPlayerVehicleID(playerid);
if(v == pcar)
{
if(!strcmp(name, "OwnerName", true))
{
SendClientMessage(playerid, 0x999999AA, "Welcome to your private vehicle!");
}
else
{
SendClientMessage(playerid, 0x999999AA, "This vehicle belongs to OwnerName!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
Re: Personal Car -
Petru_Me - 02.04.2011
Thank you ! but :
Код:
H:\Global\gamemodes\petru.pwn(6852) : error 017: undefined symbol "name"
Re: Personal Car -
Sascha - 02.04.2011
oh sorry..
use this:;
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
new v = GetPlayerVehicleID(playerid);
if(v == pcar)
{
if(!strcmp(pname, "OwnerName", true))
{
SendClientMessage(playerid, 0x999999AA, "Welcome to your private vehicle!");
}
else
{
SendClientMessage(playerid, 0x999999AA, "This vehicle belongs to OwnerName!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
Re: Personal Car -
Petru_Me - 02.04.2011
Thank you but another error . When I try to enter in my car doesn't work . Why ?
Re: Personal Car -
farris - 02.04.2011
did you change
if(!strcmp(pname, "OwnerName", true))
to accompany your name
Re: Personal Car -
Sascha - 02.04.2011
have you changed the name to your name?
and added a unique variable for your vehicle?
(in this way you need 1 variable for each private vehicle)