[HELP] Needed Fix
#2

This should work:

Код:
	if(strcmp(cmd, "/createcar", true) == 0)
	{
	    if(!(PlayerInfo[playerid][pAdmin] < 4))
			return SendClientMessage(playerid, 0xFF0000AA, "[Error]: You don't have permission to use this command!");

	    tmp = strtok(cmdtext, idx);
	    if(!strlen(tmp))
	        return SendClientMessage(playerid, 0xFF0000AA, "[Error]: /createcar [vehicle name | vehicle ID] [color1] [color2] [respawnable]");

		new car = ReturnVehicleModelID(tmp);
		if(!car)
			return SendClientMessage(playerid, 0xFF0000AA, "[Error]: Invalid vehicle name | vehicle ID.");

	    new color1, color2;
	    tmp = strtok(cmdtext, idx);
	    if(!strlen(tmp))
		{
	        color1 = -1;
	        color2 = -1;
		}
		else
		{
			color1 = strval(tmp);
			if(color1 < -1 || color1 > 200)
				return SendClientMessage(playerid, 0xFF0000AA "[Error]: Enter a valid color [0-200]");

	    	tmp = strtok(cmdtext, idx);
	    	if(!strlen(tmp)) color2 = color1;
	    	else color2 = strval(tmp);
	    	if(color2 < -1 || color2 > 200)
				return SendClientMessage(playerid, 0xFF0000AA, "[Error]: Enter a valid color [0-200]");
		}

		if(IsPlayerInAnyVehicle(playerid))
		    RemovePlayerFromVehicle(playerid);
 		new	Float:X, Float:Y, Float:Z, Float:A;
        GetPlayerPos(playerid, X,Y,Z);
		GetPlayerFacingAngle(playerid,A);
		new carid = CreateVehicle(car, X,Y,Z,A, color1, color2, -1);

	    tmp = strtok(cmdtext, idx);


		PutPlayerInVehicle(playerid,carid,0);
		LinkVehicleToInterior(carid,GetPlayerInterior(playerid));
		for(new i = 0; i < sizeof(CreatedCars); i++)
		{
		    if(CreatedCars[i] == INVALID_VEHICLE_ID)
		    {
		        CreatedCars[i] = carid;
				break;
			}
		}
		return 1;
	}
Reply


Messages In This Thread
[HELP] Needed Fix - by Mr.Obscure - 25.08.2010, 14:10
Re: [HELP] Needed Fix - by Pawno_Master - 25.08.2010, 14:17
Re: [HELP] Needed Fix - by Mr.Obscure - 25.08.2010, 14:19
Re: [HELP] Needed Fix - by Mr.Obscure - 25.08.2010, 14:21
Re: [HELP] Needed Fix - by Pawno_Master - 25.08.2010, 14:24
Re: [HELP] Needed Fix - by Mr.Obscure - 25.08.2010, 14:42
Re: [HELP] Needed Fix - by Mr.Obscure - 25.08.2010, 14:47
Re: [HELP] Needed Fix - by Mr.Obscure - 25.08.2010, 15:19
Re: [HELP] Needed Fix - by Pawno_Master - 25.08.2010, 15:20
Re: [HELP] Needed Fix - by Mr.Obscure - 25.08.2010, 15:33

Forum Jump:


Users browsing this thread: 1 Guest(s)