21.02.2013, 18:52
Any help creating a jetpack command only for admins ? I tried by myself but it has too many errors, so I hope that any of you can help me.
if(strcmp(cmdtext,"/jetpack",true) == 0)
{
if(IsPlayerAdmin(playerid)) //You need to be logged with rcon to use this command you can edit it
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
SetPlayerPos(playerid, X, Y, Z);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
SendClientMessage(playerid, 0x15FF00AA, "* You Have Succefully Spawned Jetpack");
}
else
{
SendClientMessage(playerid, 0xFF0000FF, "[ERROR]: You need to be RCON admin to use this command");
}
return 1;
}
Try this dude:
if(strcmp(cmdtext,"/jetpack",true) == 0) { if(PlayerInfo[playerid][pAdmin] >= 5) { SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USE JETPACK); SendClientMessage(playerid, COLOR_LIGHTBLUE, "**Now fly away!"); } else { SendClientMessage(playerid, COLOR_GREY, "**You cant use this command!"); } return 1; } |
CMD:jetpack(playerid, params[])
{
new targetidname[MAX_PLAYER_NAME],targetid; new string[256];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(IsPlayerConnected(playerid))
{
if(!sscanf(params,"u",targetid))
{
GetPlayerName(targetid, targetidname, sizeof(targetidname));
format(string,sizeof(string),"Un administrator i-a dat un Jetpack lui %s", targetidname);
SendClientMessageToAll(-1, string);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
}
else return SendClientMessage(playerid,1,"Utilizare: /jetpack (ID/Name);");
}
}
else return SendClientMessage(playerid, "Trebuie sa fi admin pentru a folosi aceasta comanda.");
return 1;
}
C:\Users\Mihai\Desktop\samp\Romanian Project Roleplay\gamemodes\ZRP.pwn(23776) : error 035: argument type mismatch (argument 2)
C:\Users\Mihai\Desktop\samp\Romanian Project Roleplay\gamemodes\ZRP.pwn(23777) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
That's my code ( borrowed some things from other script )
pawn Код:
and this is the error pawn Код:
so, what's wrong? |
That's my code ( borrowed some things from other script )
pawn Код:
and this is the error pawn Код:
so, what's wrong? |
CMD:jetpack(playerid, params[])
{
new targetidname[MAX_PLAYER_NAME], targetid, string[148];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid,1,"Utilizare: /jetpack (ID/Name);");
GetPlayerName(targetid, targetidname, sizeof(targetidname));
format(string,sizeof(string),"Un administrator i-a dat un Jetpack lui %s", targetidname);
SendClientMessageToAll(-1, string);
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_USEJETPACK);
} else SendClientMessage(playerid, "Trebuie sa fi admin pentru a folosi aceasta comanda.");
return true;
}
try this:
pawn Код:
|
C:\Users\Mihai\Desktop\samp\Romanian Project Roleplay\gamemodes\ZRP.pwn(23769) : error 035: argument type mismatch (argument 2)