well i have this command in my admin script , its /givecar [playerid] it gives the player a random car i think here it is but u need to define the dcmd :
Top Of Script :
Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
Anywhere in the script :
Код:
dcmd_givecar(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) { // define this as u wish
if(!strlen(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:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z);
CarSpawner(player1,415);
GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(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(playerid, red, "Player is not connected or is yourself");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}
OnPlayerCommandText:
Код:
dcmd(givecar,7,cmdtext);
________
Wiki vaporizer