SA-MP Forums Archive
Have problem with privatecars.pwn my own - 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)
+--- Thread: Have problem with privatecars.pwn my own (/showthread.php?tid=591342)



Have problem with privatecars.pwn my own - MojorX - 10.10.2015




Re: Have problem with privatecars.pwn my own - Unte99 - 10.10.2015

Show us some code. You are giving us nothing to work with.

By the way, use [ code ]TEXT[ /code ] (without spaces) for code and errors.


Re: Have problem with privatecars.pwn my own - Face9000 - 11.10.2015

*looks at his magic ball*

Yeah, still can't guess the code to fix.


Re: Have problem with privatecars.pwn my own - MojorX - 11.10.2015

Код:
// PRIVATE CARS SCRIPT MADE BY Wolf_Lv

#include <a_samp>

new privatecar;

public OnFilterScriptInit ()
{
   privatecar = CreateVehicle(400, 0, 0, 0, 0, 1, 1, 86000);
   return 1;
}

 public OnPlayerStateChange(playerid, newstate, oldstate)
 {
	new vehicleid = GetPlayerVehicleID(playerid);
	
	if(newstate == PLAYER_STATE_DRIVER)
	{
		if(vehicleid == privatecar)
		{
			if(strcmp(GetName(playerid), "Wolf_Lv", true)
			{
				return 1;
			}
			else
			{
				RemovePlayerFromVehicle(playerid);
			}
		}
	 }
	 return 1;
 }
 
 stock GetName(playerid)
 {
	 new name[MAX_PLAYER_NAME];
	 GetPlayerName(playerid, name, sizeof name);
	 return name;
 }



Re: Have problem with privatecars.pwn my own - AbyssMorgan - 11.10.2015

PHP код:
if(strcmp(GetName(playerid), "Wolf_Lv"true//look
if(strcmp(GetName(playerid), "Wolf_Lv"true)) 



Re: Have problem with privatecars.pwn my own - MojorX - 11.10.2015

Need make it or replace it?


Re: Have problem with privatecars.pwn my own - AbyssMorgan - 11.10.2015

replace

PHP код:
if(strcmp(GetName(playerid), "Wolf_Lv"true//error
if(strcmp(GetName(playerid), "Wolf_Lv"true)) //ok 
you see a mistake or not ?


Re: Have problem with privatecars.pwn my own - MojorX - 11.10.2015

Thank you, worked


Re: Have problem with privatecars.pwn my own - thefirestate - 11.10.2015

The function you are using will remove the player from the vehicle if the name is Wolf_Lv, and will let the player enter if the name is different from Wolf_Lv,
You should use this one instead:

PHP код:
if(!strcmp(GetName(playerid), "Wolf_Lv"true)) 



Re: Have problem with privatecars.pwn my own - Unte99 - 11.10.2015

Quote:
Originally Posted by thefirestate
Посмотреть сообщение
The function you are using will remove the player from the vehicle if the name is Wolf_Lv, and will let the player enter if the name is different from Wolf_Lv,
You should use this one instead:

PHP код:
if(!strcmp(GetName(playerid), "Wolf_Lv"true)) 
Also, the ignorecase parameter should be false, because another player with nickname WOLF_LV could drive the car also.