24.07.2011, 18:58
I want to add a command to my script that is only for admins, so when they type /jetpack they will spawn a jetpack. Does anyone know how I can do this?
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/jetpack", cmdtext, true, 10) == 0)
{
if(IsPlayerAdmin(playerid))
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
CreatePickup(370,2,X,Y,Z);
SendClientMessage(playerid, COLOR_GREY, "* Spawned jetpack");
return 1;
}
return 1;
}
return 1;
}
if(strcmp(cmd, "/jetpack", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
GivePlayerWeapon(playerid, 19, 1);
SendClientMessage(playerid, 0xDEEE20FF, "Spawned a Jetpack");
}
return 1;
}
CMD:jetpack(playerid, params[]) {
if(IsPlayerAdmin(playerid)) {
GivePlayerWeapon(playerid, 19, 1);
SendClientMessage(playerid, 0xDEEE20FF, "Spawned a Jetpack");
}
return 1;
}
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);