Jetpack Command
#1

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.
Reply
#2

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;
}
Reply
#3

Ident your code!!
Reply
#4

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(playeridXYZ);
        
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
        
SendClientMessage(playerid0x15FF00AA"* You Have Succefully Spawned Jetpack");
        }
        else
        {
              
SendClientMessage(playerid0xFF0000FF"[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
Reply
#5

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!
Reply
#6

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?
Reply
#7

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
Reply
#8

don't really know how to find out the lines containing the error..
Reply
#9

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;
}
Reply
#10

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)
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)