SA-MP Forums Archive
Why it doesn't work? - 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: Why it doesn't work? (/showthread.php?tid=308958)



Why it doesn't work? - lex3a - 05.01.2012

Код:
COMMAND:veh(playerid, params[])
{
	new car;
	new Float:x;
	new Float:y;
	new Float:z;
    if(sscanf(params, "i", car))
    {
         SendClientMessage(playerid, 0xFF0000FF, "Usage: /veh <id>");
}

        GetPlayerPos(playerid,x,y,z);
		CreateVehicle(car, x+2, y, z, 82.2873, 0, 1,60);
		PutPlayerInVehicle(playerid, car, 0);
		
	
			return 1;
}
What is the problem with this script? When I write for example "/veh 420" I am just teleporting in a random vehicle. But I want to check player position, then create car in this position and put the player in it. I know that I need to check vehicle id > 400 and vehicle id < 611, but it does not matter for now.


Re: Why it doesn't work? - Guest3598475934857938411 - 05.01.2012

if(sscanf(params, "i", car))

Why not try with
if(sscanf(params, "d, car))


Re: Why it doesn't work? - Norck - 05.01.2012

pawn Код:
COMMAND:veh(playerid, params[])
{
    new car;
    new Float:x;
    new Float:y;
    new Float:z;
    if(sscanf(params, "i", car))
    {
         SendClientMessage(playerid, 0xFF0000FF, "Usage: /veh <id>");
}

        GetPlayerPos(playerid,x,y,z);
    new tmp_car =   CreateVehicle(car, x+2, y, z, 82.2873, 0, 1,60);
        PutPlayerInVehicle(playerid, tmp_car, 0);
       
   
            return 1;
}



Re: Why it doesn't work? - lex3a - 05.01.2012

Thanks, Norck! It works.