SA-MP Forums Archive
trying to upgrade the armor command buit it doesnt work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: trying to upgrade the armor command buit it doesnt work (/showthread.php?tid=330753)



trying to upgrade the armor command buit it doesnt work - stefke150 - 02.04.2012

i'm a noobie in scripting so

if the player is using the command /armour then her get 100 armor
but if the player already have 100 armor he can't use that command


i got something like this


PHP код:
#include <a_samp>
#define COLOR_RED 0xFF0000FF
#define COLOR_GREEN 0x00FF00FF
new Float:armour;
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/armour"cmdtexttrue10) == 0)
    {
        
#if(playerid,armour, 100);
        
GetPlayerArmour(playeridarmour);
        
SendClientMessage(playerid,COLOR_RED,"you already have an armour");
        
#else
        
SetPlayerArmour(playerid100);
        
SendClientMessage(playerid,COLOR_RED"you have buyed bulletproof vest");
        
GivePlayerMoney(playerid, -200);
        
#endif
        
return 1;
        }
    return 
0;




Re: trying to upgrade the armor command buit it doesnt work - Catalyst- - 02.04.2012

Код:
#include <a_samp>
#define COLOR_RED 0xFF0000FF
#define COLOR_GREEN 0x00FF00FF

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/armour", cmdtext, true, 10) == 0)
    {
        new Float: armour;
        GetPlayerArmour(playerid, armour);
        if(armour < 100)
        {
	        SetPlayerArmour(playerid, 100);
	        GivePlayerMoney(playerid, -200);
	        SendClientMessage(playerid,COLOR_RED, "You have bought a bulletproof vest");
	        return 1;
        }
	else return SendClientMessage(playerid, COLOR_RED, "You already have full armour");
    }
    return 0;
}



Re: trying to upgrade the armor command buit it doesnt work - stefke150 - 02.04.2012

thnx


Re: trying to upgrade the armor command buit it doesnt work - Shouty - 25.06.2012

Nope...


Код:
if (strcmp("/armour", cmdtext, true, 10) == 0)
    {
     new Float: Armour;
     GetPlayerArmour(playerid, Armour);
     if(Armour < 100) {
      if(GetPlayerMoney(playerid) >= 200) {
	        SetPlayerArmour(playerid, 100);
	        GivePlayerMoney(playerid, -200);
	        SendClientMessage(playerid,-1, "Your armour is now Full! xD");
	        return 1;
      } else return SendClientMessage(playerid, -1," You need more money ,dude...");
     } else return SendClientMessage(playerid, -1 , " Your armour is alerty full");
}