#1

Doing this Vehicle spawner....
And I get errors.

Код:
C:\Users\X\Desktop\RP server\filterscripts\new.pwn(111) : error 029: invalid expression, assumed zero
C:\Users\X\Desktop\RP server\filterscripts\new.pwn(111) : error 017: undefined symbol "cmd_veh"
C:\Users\X\Desktop\RP server\filterscripts\new.pwn(111) : error 029: invalid expression, assumed zero
C:\Users\X\Desktop\RP server\filterscripts\new.pwn(111) : fatal error 107: too many error messages on one line

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


4 Errors.
This is the line: CMD:veh(playerid,params[])
Reply
#2

Have you included ZCMD?

Put
pawn Код:
#include <zcmd>
under
pawn Код:
#include <a_samp>
Reply
#3

Already did.
Reply
#4

And I got zcmd.inc in folder Pawno---->Includes
Reply
#5

Post up the full /veh command.
Reply
#6

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	CMD:veh(playerid,params[])
	{
		new ModelID, color[2],Float:VehPos[4], vehicleid;
		if(GetPlayerState(playerid)!=PLAYER_STATE_ONFOOT) return SendClientMessage(playerid,0xB0AFB0FF,"You cannot spawn vehicles if you are already inside a vehicle!");
		if(sscanf(params, "ddd",ModelID,color[0],color[1])) return SendClientMessage(playerid,0xB0AFB0FF, "/veh [vehicleid] [color1] [color2]");
		if(ModelID < 400 || ModelID > 611) return SendClientMessage(playerid,0xB0AFB0FF, "The vehicle id must be between 400 - 611");
		if(color[0] < 0 || color[0] > 255 || color[1] < 0 || color[1] > 255) return SendClientMessage(playerid,0xB0AFB0FF, "The colorid must be between  0 - 126");
		if(IsPlayerAdmin(playerid))
			{
				GetPlayerPos(playerid, VehPos[0],VehPos[1],VehPos[2]);
				GetPlayerFacingAngle(playerid, VehPos[3]);
				vehicleid = CreateVehicle(ModelID,VehPos[0],VehPos[1],VehPos[2],VehPos[3],color[0],color[1],-1);
				LinkVehicleToInterio(vehicleid,GetPlayerInterior(playerid));
        		SetVehicleVirtualWorld(vehicleid,GetPlayerVirtualWorld(playerid));
        		PutPlayerInVehicle(playerid, vehicleid, 0);
    		}
			SendClientMessage(playerid,RED,"[AcC] You do not have enough Admin Permissions to execute this Command!");
    		return 1;
	}
	return 0;
}
Reply
#7

Take this code and place it somewhere down your script. I keep all my admin commands in one group and all my player commands in a separate group to keep it tidy.
pawn Код:
CMD:veh(playerid,params[])
    {
        new ModelID, color[2],Float:VehPos[4], vehicleid;
        if(GetPlayerState(playerid)!=PLAYER_STATE_ONFOOT) return SendClientMessage(playerid,0xB0AFB0FF,"You cannot spawn vehicles if you are already inside a vehicle!");
        if(sscanf(params, "ddd",ModelID,color[0],color[1])) return SendClientMessage(playerid,0xB0AFB0FF, "/veh [vehicleid] [color1] [color2]");
        if(ModelID < 400 || ModelID > 611) return SendClientMessage(playerid,0xB0AFB0FF, "The vehicle id must be between 400 - 611");
        if(color[0] < 0 || color[0] > 255 || color[1] < 0 || color[1] > 255) return SendClientMessage(playerid,0xB0AFB0FF, "The colorid must be between  0 - 126");
        if(IsPlayerAdmin(playerid))
            {
                GetPlayerPos(playerid, VehPos[0],VehPos[1],VehPos[2]);
                GetPlayerFacingAngle(playerid, VehPos[3]);
                vehicleid = CreateVehicle(ModelID,VehPos[0],VehPos[1],VehPos[2],VehPos[3],color[0],color[1],-1);
                LinkVehicleToInterio(vehicleid,GetPlayerInterior(playerid));
                SetVehicleVirtualWorld(vehicleid,GetPlayerVirtualWorld(playerid));
                PutPlayerInVehicle(playerid, vehicleid, 0);
            }
            SendClientMessage(playerid,RED,"[AcC] You do not have enough Admin Permissions to execute this Command!");
            return 1;
    }
ZCMD doesn't require the code to be in OnPlayerCommandText.

EDIT: Also; this line will execute if someone is actually allowed to do it.
pawn Код:
SendClientMessage(playerid,RED,"[AcC] You do not have enough Admin Permissions to execute this Command!");
Add 'else' to the beginning of the line. So:
pawn Код:
else SendClientMessage(playerid,RED,"[AcC] You do not have enough Admin Permissions to execute this Command!");
Reply
#8

OOoh so thats why it doesnt work? because its under playercommand? As no CMD commands work for me...
Reply
#9

Yes :P

Does it work now? (Also, look to my last post's edit I added).
Reply
#10

Yea was going to ask about that now xD

1 error
C:\Users\Philip\Desktop\RP server\filterscripts\new.pwn(269) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.


Код:
CMD:veh(playerid,params[])
	{
		new ModelID, color[2],Float:VehPos[4], vehicleid;
		if(GetPlayerState(playerid)!=PLAYER_STATE_ONFOOT) return SendClientMessage(playerid,0xB0AFB0FF,"You cannot spawn vehicles if you are already inside a vehicle!");
		if(sscanf(params, "ddd",ModelID,color[0],color[1])) return SendClientMessage(playerid,0xB0AFB0FF, "/veh [vehicleid] [color1] [color2]");
		if(ModelID < 400 || ModelID > 611) return SendClientMessage(playerid,0xB0AFB0FF, "The vehicle id must be between 400 - 611");
		if(color[0] < 0 || color[0] > 255 || color[1] < 0 || color[1] > 255) return SendClientMessage(playerid,0xB0AFB0FF, "The colorid must be between  0 - 126");
		if(IsPlayerAdmin(playerid))
			{
				GetPlayerPos(playerid, VehPos[0],VehPos[1],VehPos[2]);
				GetPlayerFacingAngle(playerid, VehPos[3]);
				vehicleid = CreateVehicle(ModelID,VehPos[0],VehPos[1],VehPos[2],VehPos[3],color[0],color[1],-1);
				LinkVehicleToInterior(vehicleid,GetPlayerInterior(playerid));
        		SetVehicleVirtualWorld(vehicleid,GetPlayerVirtualWorld(playerid));
        		PutPlayerInVehicle(playerid, vehicleid, 0);
    		}
			else SendClientMessage(playerid,RED,"[AcC] You do not have enough Admin Permissions to execute this Command!");
			return 1;
	}
Its the last line with return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)