[Help requested] Small little command help
#1

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/helpme", cmdtext, true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "[INFO]This help command is still in BETA");
        SendClientMessage(playerid, COLOR_ORANGE, "[INFO]Enjoy the tutorial!");
        SendClientMessage(playerid, COLOR_ORANGE, "[INFO]/Heal - Heals you. /Kill - Performs suicide. /Getspas - Gets a spas12");
        return 1;
    }
    if (strcmp("/healme", cmdtext, true, 5) == 0)
    {
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You have been healed!(This heal command is still in BETA!)");
        return 1;
    }
    if (strcmp("/getspas", cmdtext, true, 10) == 0)
	{
	    GivePlayerWeapon(playerid, 27, 1500); //Give playerid SPAS12 with 1500 ammo
		SendClientMessage(playerid, COLOR_GREEN, "Enjoy the gun honey, x Mom.");
		return 1;
	}
	return 0;
}
It's about the /getspas command. I want it scripted so it costs money when you /getspas. And if you don't have the money it will say "Better have your money ready next time... X Mom"! Who could help me?
Reply
#2

pawn Код:
if(strcmp("/getspas",cmdtext,true, 8) == 0)
    {
        GivePlayerWeapon(playerid, 27, 1500);
        SendClientMessage(playerid, COLOR_GREEN, "Enjoy the gun honey, x Mom.");
        else if(GetPlayerMoney[playerid] == < 500); return SendClientMessage(playerid, COLOR_GREEN, "Better Have your money ready next time... X Mom");
        return 1;
    }
    return 0;
}
Try this haven't tested on mobile
Reply
#3

Quote:
Originally Posted by Songason
Посмотреть сообщение
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/helpme", cmdtext, true, 5) == 0)
    {
        SendClientMessage(playerid, COLOR_BLUE, "[INFO]This help command is still in BETA");
        SendClientMessage(playerid, COLOR_ORANGE, "[INFO]Enjoy the tutorial!");
        SendClientMessage(playerid, COLOR_ORANGE, "[INFO]/Heal - Heals you. /Kill - Performs suicide. /Getspas - Gets a spas12");
        return 1;
    }
    if (strcmp("/healme", cmdtext, true, 5) == 0)
    {
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, COLOR_YELLOW, "(INFO) You have been healed!(This heal command is still in BETA!)");
        return 1;
    }
    if (strcmp("/getspas", cmdtext, true, 10) == 0)
	{
	    GivePlayerWeapon(playerid, 27, 1500); //Give playerid SPAS12 with 1500 ammo
		SendClientMessage(playerid, COLOR_GREEN, "Enjoy the gun honey, x Mom.");
		return 1;
	}
	return 0;
}
It's about the /getspas command. I want it scripted so it costs money when you /getspas. And if you don't have the money it will say "Better have your money ready next time... X Mom"! Who could help me?
Thanks!
Reply
#4

I got a few errors

(Error) Invalid expression, assumed zero
(Warning) Expression has no effect
(Error) Expected token
(Error) Invalid subscript
(Error) Too many errors on one line
Reply
#5

Error lines please.
Reply
#6

pawn Код:
if(strcmp("/getspas",cmdtext,true, 8) == 0)
    {
        if(GetPlayerMoney(playerid) < 250) return SendClientMessage(playerid,-1,"Mister Buttfucker, Earn 250$ First");
        GivePlayerWeapon(playerid, 27, 1500);
        SendClientMessage(playerid, COLOR_GREEN, "Enjoy The Gun, Mister Buttfucker.");
        return 1;
    }
    return 0;
}
Reply
#7

it's hard on mobile, ya know
Reply
#8

pawn Код:
if (strcmp("/getspas", cmdtext, true) == 0)
{
    if(GetPlayerMoney(playerid) < 1000) // you can change 1000 to any amount ya like
    {
        SendClientMessage(playerid, COLOR_GREEN, "You do not have enough cash!");
        return 1;
    }
    else // if he has enough cash
    {
        GivePlayerMoney(playerid, -1000); // takes 1000 from the player
        GivePlayerWeapon(playerid, 27, 1500); //Give playerid SPAS12 with 1500 ammo
        SendClientMessage(playerid, COLOR_GREEN, "Enjoy the gun honey, x Mom.");
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by HellSphinX
Посмотреть сообщение
pawn Код:
if (strcmp("/getspas", cmdtext, true, 10) == 0)
{
    if(GetPlayerMoney(playerid) < 1000) // you can change 1000 to any amount ya like
    {
        SendClientMessage(playerid, COLOR_GREEN, "You do not have enough cash!");
        return 1;
    }
    else // if he has enough cash
    {
        GivePlayerMoney(playerid, -1000); // takes 1000 from the player
        GivePlayerWeapon(playerid, 27, 1500); //Give playerid SPAS12 with 1500 ammo
        SendClientMessage(playerid, COLOR_GREEN, "Enjoy the gun honey, x Mom.");
    }
    return 1;
}
Quote:

if (strcmp("/getspas", cmdtext, true, 10) == 0)

Are you sure about this?
Reply
#10

Quote:
Originally Posted by Littlehelper[MDZ]
Посмотреть сообщение
Are you sure about this?
Stop posting for the sake of your postcount.
The strcmp code is good and should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)