06.07.2014, 20:57
Hello, i would like to recreate this code from an old ngrp edit:
So that i have an admin cmd to /createpvehicle, but instead in this type of format:
please help me
Код:
CMD:createpvehicle(playerid, params[]) { if (PlayerInfo[playerid][pAdmin] < 4) { SendClientMessageEx(playerid, COLOR_GREY, " You are not allowed to use this command."); return 1; } new string[128], giveplayerid, modelid, color1, color2; if(sscanf(params, "uddd", giveplayerid, modelid, color1, color2)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /createpvehicle [playerid] [modelid] [color 1] [color 2]"); if(color1 < 0 || color1 > 126) { SendClientMessageEx(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; } if(color2 < 0 || color2 > 126) { SendClientMessageEx(playerid, COLOR_GREY, " Color Number can't be below 0 or above 126 !"); return 1; } if(modelid < 400 || modelid > 611) { SendClientMessageEx(playerid, COLOR_GREY, " Vehicle Number can't be below 400 or above 611 !"); return 1; } new playervehicleid = GetPlayerFreeVehicleId(giveplayerid); if(playervehicleid == -1) return SendClientMessageEx(playerid, COLOR_GREY, "ERROR: That player can't have more cars."); new Float:X,Float:Y,Float:Z; GetPlayerPos(giveplayerid,X,Y,Z); new Float:Angle; GetPlayerFacingAngle(giveplayerid,Angle); new car = CreatePlayerVehicle(giveplayerid, playervehicleid, modelid, X, Y, Z, Angle, color1, color2, 0); if(car == INVALID_PLAYER_VEHICLE_ID) { SendClientMessageEx(playerid, COLOR_GREY, "ERROR: Something went wrong and the car didn't get created."); } else { format(string, sizeof(string), " Vehicle successfully created with ID %d.", car); SendClientMessageEx(playerid, COLOR_GRAD1, string); } format(string, sizeof(string), "%s has created a %s for %s (Color 1: %d | Color 2: %d).", GetPlayerNameEx(playerid), GetVehicleName(car), GetPlayerNameEx(giveplayerid), color1, color2); Log("logs/playervehicle.log", string); return 1; }
Код:
if(strcmp(cmd, "/unmuteplayers", true) == 0) { if(!(PlayerInfo[playerid][pAdmin] >= 2)) { return ErrorMessage(playerid, "You cannot use this command."); } tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SyntaxMessage(playerid, "/unmuteplayers [distance]"); new radius = strval(tmp); SendClientMessage(playerid,YELLOW,"You have unmuted all players within that radius."); for(new i = 0; i < MAX_PLAYERS; i++) { if(playerid != i && IsPlayerConnected(i)) { new Float:distance = GetDistanceBetweenPlayers(playerid,i); if(distance > 0 && distance <= radius) { PlayerInfo[i][pMuted] = 0; } } } return 1; }