SA-MP Forums Archive
Making Car system.. Need som 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: Making Car system.. Need som help..! (/showthread.php?tid=72476)



Making Car system.. Need som help..! - Danand - 08.04.2009

Okey! Hello! I'm making a car ownership system.. And I'm geting som errors now that i cant solv! I have tryed many hours now!! Can't get the errors away!!!
Here is the script:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	new carid[256];
	format(carid, 256, "%d", vehicleid);
	new car_name = dini_Int(carid, "name");

	if(dini_Exists(carid))
	{
	new plname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, plname, sizeof(plname));
	if(strcmp(plname, car_name, true) == 0)
 	{
 	SendClientMessage(playerid, COLOR_YELLOW, "Welcome back! Type /stats for status off the car.");
 	{
 	else
  {
    
  }
 	}
 	else
 	{
	SendClientMessage(playerid, COLOR_YELLOW, "This car is for sale! Type /buycar for buy it.");
 	}

	return 1;
}
The error is from the way i try to get playername!
Really need help with this one.. What ever i do, i get error!


Re: Making Car system.. Need som help..! - miokie - 08.04.2009

What are the errors?


Re: Making Car system.. Need som help..! - hanzen - 08.04.2009

You should try post the errors?


Re: Making Car system.. Need som help..! - Rks25 - 08.04.2009

Try this.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  new carid[256];
  format(carid, 256, "%d", vehicleid);
  new car_name = dini_Int(carid, "name");

  if(dini_Exists(carid))
  {
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    if(strcmp(plname, car_name, true) == 0)
    {
      SendClientMessage(playerid, COLOR_YELLOW, "Welcome back! Type /stats for status off the car.");
    }
    else
    {
      //
    }
  }
  else
  {
    SendClientMessage(playerid, COLOR_YELLOW, "This car is for sale! Type /buycar for buy it.");
  }
  return 1;
}



Re: Making Car system.. Need som help..! - Danand - 08.04.2009

Код:
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(247) : error 035: argument type mismatch (argument 2)
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(251) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(256) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(264) : warning 217: loose indentation
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(264) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(264) : error 004: function "OnPlayerExitVehicle" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(269) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(269) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(269) : error 004: function "OnPlayerStateChange" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(274) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(274) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(274) : error 004: function "OnPlayerEnterCheckpoint" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(279) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(279) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(279) : error 004: function "OnPlayerLeaveCheckpoint" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(284) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(284) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(284) : error 004: function "OnPlayerEnterRaceCheckpoint" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(289) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(289) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(289) : error 004: function "OnPlayerLeaveRaceCheckpoint" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(294) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(294) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(294) : error 004: function "OnRconCommand" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(299) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(299) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(299) : error 004: function "OnObjectMoved" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(304) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(304) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(304) : error 004: function "OnPlayerObjectMoved" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(309) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(309) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(309) : error 004: function "OnPlayerPickUpPickup" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(314) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(314) : error 029: invalid expression, assumed zero
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(314) : error 004: function "OnPlayerSelectedMenuRow" is not implemented
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(319) : warning 225: unreachable code
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(319) : error 029: invalid expression, assumed zero

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
The error is from where i try to get the Playername!!


Re: Making Car system.. Need som help..! - Rks25 - 08.04.2009

Try my code.


Re: Making Car system.. Need som help..! - Danand - 08.04.2009

C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(247) : error 035: argument type mismatch (argument 2)
C:\Users\Daniel Andersen\Desktop\Annet\SAMP\SAMP Server\filterscripts\test.pwn(244) : warning 204: symbol is assigned a value that is never used: "car_name"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.



Re: Making Car system.. Need som help..! - Rks25 - 08.04.2009

and that is redirecting to which line?
i guess: if(strcmp(plname, car_name, true) == 0)

Correct?


Re: Making Car system.. Need som help..! - Danand - 08.04.2009

Yes


Re: Making Car system.. Need som help..! - Rks25 - 08.04.2009

Change
pawn Код:
new car_name;
to
pawn Код:
new car_name[255];