Jetpack Command -
ghzspark - 21.02.2013
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.
Re: Jetpack Command -
ZeroCools - 21.02.2013
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;
}
Re: Jetpack Command -
Luis- - 21.02.2013
Ident your code!!
Re: Jetpack Command -
Mark_Samp - 21.02.2013
Here try this :
PHP код:
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;
}
I didn't test it but i hope it work
Tell me if it worked
Re: Jetpack Command -
Goldino - 21.02.2013
Quote:
Originally Posted by ZeroCools
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;
}
|
Firstly, why do you copy code from another script?
Secondly, you will make things worse.
2 things that are wrong in that code, because you copied it from another script,
-It will cause many warnings, due to the indentation.
-There will be errors, because he might not use pAdmin, he could just use Rcon, or another Admin script.
And four tips,
-Don't copy code from another script
-Ask him what command processor he uses. Maybe strcmp, zcmd, dcmd or ycmd.
-Use code tags for scripts.
-Indent your code!
Re: Jetpack Command -
ghzspark - 21.02.2013
That's my code ( borrowed some things from other script )
pawn Код:
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;
}
and this is the error
pawn Код:
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
so, what's wrong?
Re: Jetpack Command -
Goldino - 21.02.2013
Quote:
Originally Posted by ghzspark
That's my code ( borrowed some things from other script )
pawn Код:
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; }
and this is the error
pawn Код:
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
so, what's wrong?
|
Post both of the lines which contain the errors
Re: Jetpack Command -
ghzspark - 21.02.2013
don't really know how to find out the lines containing the error..
Re: Jetpack Command -
benel1 - 21.02.2013
Quote:
Originally Posted by ghzspark
That's my code ( borrowed some things from other script )
pawn Код:
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; }
and this is the error
pawn Код:
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
so, what's wrong?
|
try this:
pawn Код:
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;
}
Re: Jetpack Command -
ghzspark - 22.02.2013
Quote:
Originally Posted by benel1
try this:
pawn Код:
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; }
|
still getting this
pawn Код:
C:\Users\Mihai\Desktop\samp\Romanian Project Roleplay\gamemodes\ZRP.pwn(23769) : error 035: argument type mismatch (argument 2)