HELP /GIVECAR CMD
#1

How to make command like /givecar 2 infernus 1 1 "/givecar [PlayerId] [Name/Modelid] [Color1] [Color2]"

my /givecar command now
PHP код:
CMD:givecar(playerid,params[]) {
    if(
PlayerInfo[playerid][Level] >= || IsPlayerAdmin(playerid)) {
        if(
isnull(params)) return SendClientMessage(playerid,red,"USAGE: /givecar [playerid]");
        new 
player1 strval(params), playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
        if(
PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
     if(
IsPlayerInAnyVehicle(player1)) return SendClientMessage(playerid,red,"ERROR: Player already has a vehicle");
         if(
IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {
            
CMDMessageToAdmins(playerid,"GIVECAR");
            new 
Float:xFloat:yFloat:z;    GetPlayerPos(player1,x,y,z);
            
CarSpawner(player1,415);
            
GetPlayerName(player1playernamesizeof(playername));        GetPlayerName(playeridadminnamesizeof(adminname));
            
format(string,sizeof(string),"Administrator %s has given you a car",adminname);    SendClientMessage(player1,blue,string);
            
format(string,sizeof(string),"You have given %s a car"playername); return SendClientMessage(playerid,blue,string);
        } else return 
SendClientMessage(playeridred"Player is not connected or is yourself");
    } else return 
SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");

and my /car command maybe it helps.

PHP код:
CMD:car(playerid,params[]) {
    if(
PlayerInfo[playerid][Level] >= 3) {
        new 
tmp[128], tmp2[128], tmp3[128], Indextmp strtok(params,Index), tmp2 strtok(params,Index); tmp3 strtok(params,Index);
        if(
isnull(tmp)) return SendClientMessage(playeridred"USAGE: /car [Modelid/Name] [colour1] [colour2]");
        new 
carcolour1colour2string[128];
           if(!
IsNumeric(tmp)) car GetVehicleModelIDFromName(tmp); else car strval(tmp);
        if(
car 400 || car 611) return  SendClientMessage(playeridred"ERROR: Invalid Vehicle Model");
        if(
isnull(tmp2)) colour1 random(126); else colour1 strval(tmp2);
        if(
isnull(tmp3)) colour2 random(126); else colour2 strval(tmp3);
        new 
LVehicleID,Float:X,Float:Y,Float:ZFloat:Angle,int1;    GetPlayerPos(playeridX,Y,Z);    GetPlayerFacingAngle(playerid,Angle);   int1 GetPlayerInterior(playerid);
        
LVehicleID CreateVehicle(carX+3,Y,ZAnglecolour1colour2, -1); LinkVehicleToInterior(LVehicleID,int1);
        
CMDMessageToAdmins(playerid,"CAR");
        
format(stringsizeof(string), "%s spawned a \"%s\" (Model:%d) colour (%d, %d), at %0.2f, %0.2f, %0.2f"pName(playerid), VehicleName[car-400], carcolour1colour2XYZ);
        
SaveToFile("CarSpawns",string);
        
format(stringsizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)"VehicleName[car-400], carcolour1colour2);
        
PutPlayerInVehicle(playeridLVehicleID0);
        
VehicleInfo[LVehicleID][Temp] = 1;
        return 
SendClientMessage(playerid,lightbluestring);
    } else return 
SendClientMessage(playerid,red,"ERROR: You need to be level 3 to use this command");

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)