Something simple i cant figer out -.-
#1

I want it so it send a message to player if thay are not in the team that can only use it..

Код:
        if(!strcmp(cmdtext,"/rpg",true)) if(gTeam[playerid] != CLASS_MERC)
        {
           weptimer[playerid] =120;
        if(weptimer[playerid]) return SendClientMessage(playerid,RED,"[ATT]:Please Wait Before Using This Command Again!");
        GivePlayerWeapon(playerid, 35, 50);
        SendClientMessage(playerid, RED, "[ATT]: RPG Recieved With 50 Rockets!");
        return 1;
        }
This does nothing..

Код:
        if(!strcmp(cmdtext,"/rpg",true)) if(gTeam[playerid] != CLASS_MERC)
	    {
   		weptimer[playerid] =120;
		if(weptimer[playerid]) return SendClientMessage(playerid,RED,"[ATT]:Please Wait Before Using This Command Again!");
		GivePlayerWeapon(playerid, 35, 50);
		SendClientMessage(playerid, RED, "[ATT]: RPG Recieved With 50 Rockets!");
                else SendClientMessage(playerid, RED, "[ATT]: You Cant Use This Command!");//Addition
		return 1;
	    }
Any Help
Reply
#2

pawn Код:
if(!strcmp(cmdtext,"/rpg",true))
{
    if(gTeam[playerid] != CLASS_MERC) return SendClientMessage(playerid,RED,"Error Message!"); // He is NOT in CLASS_MERC
    if(weptimer[playerid]) return SendClientMessage(playerid,RED,"[ATT]:Please Wait Before Using This Command Again!");

    weptimer[playerid] =120; // This needs to go below the check above

    GivePlayerWeapon(playerid, 35, 50);

    SendClientMessage(playerid, RED, "[ATT]: RPG Recieved With 50 Rockets!");

    return 1;
}
You could have worked that out :P
Reply
#3

Try using the search bar in the future :S
Reply
#4

* You should also use a better command processor...
Reply
#5

Coded it in DCMD for you!


pawn Код:
dcmd_rpg(playerid, params[])
{
    #pragma unused params
    if(gTeam[playerid] != CLASS_MERC) return SendClientMessage(playerid,RED,"Error Message!");
   
    if(weptimer[playerid]) return SendClientMessage(playerid,RED,"[ATT]:Please Wait Before Using This Command Again!");
   
    GivePlayerWeapon(playerid, 35, 50);
   
    SendClientMessage(playerid, RED, "[ATT]: RPG Recieved With 50 Rockets!");
   
    weptimer[playerid] =120;
    return 1;
}
Reply
#6

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
Coded it in DCMD for you!


pawn Код:
dcmd_rpg(playerid, params[])
{
    #praagm unused params
    if(gTeam[playerid] != CLASS_MERC) return SendClientMessage(playerid,RED,"Error Message!");
   
    if(weptimer[playerid]) return SendClientMessage(playerid,RED,"[ATT]:Please Wait Before Using This Command Again!");
   
    GivePlayerWeapon(playerid, 35, 50);
   
    SendClientMessage(playerid, RED, "[ATT]: RPG Recieved With 50 Rockets!");
   
    weptimer[playerid] =120;
    return 1;
}
Wow...DCMD looks...so...SIMILAR NOW! :O...Ahh but what is #praagm and why is it there>?

Plus what do i need to run DCMD...Might as well convert it now while i have it a 1000 lines xD
Reply
#7

I used pragma because I dont use any commands like, /rpg (id)

Etc, But if I was to use it Id use scanf to do it.

There are a few tutorials out there, Take a look.
Reply
#8

Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
I used pragma because I dont use any commands like, /rpg (id)

Etc, But if I was to use it Id use scanf to do it.

There are a few tutorials out there, Take a look.
That explained nothing about why you used "#pragma unused params" in the code... As you can see in the line below, "params" exists, which could be used for making a command (for example) /kick [playerid] [reason], etc... If you only have a command like (for example) /help, which brings up a dialog you aren't using any "params" there. So it's best to tell the script; "Hey! No params exist in this command, so don't even check!". Make sense?

pawn Код:
dcmd_rpg(playerid, params[])
Reply
#9

Yes, I dont proof read to check what I typed lol.
Reply
#10

Worst "I'm a noob" excuse EVAR!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)