Car command dcmd
#1

I used ladmin4v2 and in this fs there a /car name color but only for admins and i wnat to make it for every palyer but without using ladmi4v2 because i delte it will make my onw admin system
Reply
#2

Then copy the code, and remove if(PlayerInfo[playerid][PLAYER_LEVEL]) line; not sure if its that but it should look like that
Reply
#3

This is the command

Код:
dcmd_car(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 0) {
	    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
	    if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /car [Modelid/Name] [colour1] [colour2]");
		new car, colour1, colour2, string[128];
   		if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
		if(car < 400 || car > 611) return  SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
		if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
		if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
		if(PlayerInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid) ) CarDeleter(PlayerInfo[playerid][pCar]);
		new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1;	GetPlayerPos(playerid, X,Y,Z);	GetPlayerFacingAngle(playerid,Angle);   int1 = GetPlayerInterior(playerid);
		LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1); LinkVehicleToInterior(LVehicleID,int1);
		PlayerInfo[playerid][pCar] = LVehicleID;
		CMDMessageToAdmins(playerid,"CAR");
		format(string, sizeof(string), "%s spawned a \"%s\" (Model:%d) colour (%d, %d), at %0.2f, %0.2f, %0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
        SaveToFile("CarSpawns",string);
		format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleNames[car-400], car, colour1, colour2);
		return SendClientMessage(playerid,lightblue, string);
	} else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
But if i compile and give me error undenifeid ladmin
Reply
#4

Remove the need to be an administrator. Basically, remove the check to see if they're an administrator.

Quote:

This forum requires that you wait 120 seconds between posts. Please try again in 17 seconds.

Reply
#5

Ok just can you give me the link for dcmd
Reply
#6

I found it
Reply
#7

Ok i made it but i have errors

Код:
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(270) : error 017: undefined symbol "car"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(274) : error 017: undefined symbol "red"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(276) : error 017: undefined symbol "IsNumeric"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(276) : error 017: undefined symbol "GetVehicleModelIDFromName"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(277) : error 017: undefined symbol "red"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(280) : error 017: undefined symbol "PlayerInfo"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(280) : warning 215: expression has no effect
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(280) : error 001: expected token: ";", but found "]"
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(280) : error 029: invalid expression, assumed zero
C:\Documents and Settings\user\Desktop\server samp\gamemodes\Stunt.pwn(280) : fatal error 107: too many error messages on one line

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


9 Errors.
The command

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	dcmd_car(car,3,cmdtext);
}
    dcmd_car(playerid,params[]) {
	    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
	    if(!strlen(tmp)) return SendClientMessage(playerid, red, "USAGE: /car [Modelid/Name] [colour1] [colour2]");
		new car, colour1, colour2, string[128];
   		if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
		if(car < 400 || car > 611) return  SendClientMessage(playerid, red, "ERROR: Invalid Vehicle Model");
		if(!strlen(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
		if(!strlen(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
		if(PlayerInfo[playerid][pCar] != -1 && !IsPlayerAdmin(playerid) ) CarDeleter(PlayerInfo[playerid][pCar]);
		new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1;	GetPlayerPos(playerid, X,Y,Z);	GetPlayerFacingAngle(playerid,Angle);   int1 = GetPlayerInterior(playerid);
		VehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1); LinkVehicleToInterior(LVehicleID,int1);
		PlayerInfo[playerid][pCar] = LVehicleID;
		format(string, sizeof(string), "%s spawned a \"%s\" (Model:%d) colour (%d, %d), at %0.2f, %0.2f, %0.2f", pName(playerid), VehicleNames[car-400], car, colour1, colour2, X, Y, Z);
        SaveToFile("CarSpawns",string);
		format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleNames[car-400], car, colour1, colour2);
		return SendClientMessage(playerid,lightblue, string);
	} else return SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");
}
    return 0;
}
Reply
#8

ohooooooo
Reply
#9

Can you help me or not
Reply
#10

can someone help me please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)