Allow/Disallow?
#1

How can i make it so if thay dont have 1000 fuel thay cant do this command?(Cost them 1000 fuel to do this command)

Код:
	    if(strcmp("/extract", cmdtext, true, 5) == 0)
		{
        new Float:x, Float:y, Float:z, Float:az;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, az);
        CreateVehicle(487, x+5, y+5, z, az, -1, -1, 180);
		SendClientMessage(playerid, RED, "[ATT]: Extraction Has Arrived! (Cost: 1000 Fuel To Deliver)");
		PlayerInfo[playerid][FuelAmount] = PlayerInfo[playerid][FuelAmount] -1000;
        return 1;
        }
Thanks.
Reply
#2

WTF? Are you totally stupid? Or do you really not remember anything from yesterdays posting marathon?

if(PlayerInfo[playerid][FuelAmount] < 1000) return... blah blah blah
Reply
#3

this is how I would do it.
Код:
if(strcmp("/extract", cmdtext, true, 5) == 0)
		{
                     if(PlayerInfo[playerid][FuelAmount] < 1000){
                         //player has less then 1000 fuel
                         return 0;
                     }
                     else{
                         new Float:x, Float:y, Float:z, Float:az;
                         GetPlayerPos(playerid, x, y, z);
                         GetPlayerFacingAngle(playerid, az);
                         CreateVehicle(487, x+5, y+5, z, az, -1, -1, 180);
		         SendClientMessage(playerid, RED, "[ATT]: Extraction Has Arrived! (Cost: 1000 Fuel To Deliver)");
		         PlayerInfo[playerid][FuelAmount] = PlayerInfo[playerid][FuelAmount] -1000;
                         return 1;
                     }
                }
Reply
#4

Quote:
Originally Posted by BMUK
Посмотреть сообщение
WTF? Are you totally stupid? Or do you really not remember anything from yesterdays posting marathon?

if(PlayerInfo[playerid][FuelAmount] < 1000) return... blah blah blah
See i know < > - + ++ this all means something...but what Can u show me how to search it on wiki..Ive been trying for hours -.-

EDIT: along with a wiki search for %s %d %i etc plz...
Reply
#5

Quote:
Originally Posted by per~fectionist
Посмотреть сообщение
this is how I would do it.
Код:
if(strcmp("/extract", cmdtext, true, 5) == 0)
		{
                     if(PlayerInfo[playerid][FuelAmount] < 1000){
                         //player has less then 1000 fuel
                         return 0;
                     }
                     else{
                         new Float:x, Float:y, Float:z, Float:az;
                         GetPlayerPos(playerid, x, y, z);
                         GetPlayerFacingAngle(playerid, az);
                         CreateVehicle(487, x+5, y+5, z, az, -1, -1, 180);
		         SendClientMessage(playerid, RED, "[ATT]: Extraction Has Arrived! (Cost: 1000 Fuel To Deliver)");
		         PlayerInfo[playerid][FuelAmount] = PlayerInfo[playerid][FuelAmount] -1000;
                         return 1;
                     }
                }
why doesnt it have a opening brace b4 the 1st return? theres nothing there?
Reply
#6

This should have all the info you need.
https://sampwiki.blast.hk/wiki/Category:..._Documentation
Reply
#7

Quote:
Originally Posted by <Weponz>
Посмотреть сообщение
why doesnt it have a opening brace b4 the 1st return? theres nothing there?
Its has one. behind the if statement
Reply
#8

Quote:
Originally Posted by per~fectionist
Посмотреть сообщение
This should have all the info you need.
https://sampwiki.blast.hk/wiki/Category:..._Documentation
Dude see i dont even know what there called...Please i need a tutorial or a explanation on these symbols:

Код:
%s %d %i - + ++ < > >> <<//etc
EDIT:

Quote:
Originally Posted by per~fectionist
Посмотреть сообщение
Its has one. behind the if statement
Sorry i ment "Why Does It Have One There"...

But compiles anyways...
Reply
#9

@<Weponz>

That's how it is suppost to be.

For example, all strcmp commands are like that.

pawn Код:
if(strcmp("/extract", cmdtext, true, 5) == 0)
        {
                     if(PlayerInfo[playerid][FuelAmount] < 1000){
                         //player has less then 1000 fuel
                         return 0;
                     }
                     else{
                         new Float:x, Float:y, Float:z, Float:az;
                         GetPlayerPos(playerid, x, y, z);
                         GetPlayerFacingAngle(playerid, az);
                         CreateVehicle(487, x+5, y+5, z, az, -1, -1, 180);
                 SendClientMessage(playerid, RED, "[ATT]: Extraction Has Arrived! (Cost: 1000 Fuel To Deliver)");
                 PlayerInfo[playerid][FuelAmount] = PlayerInfo[playerid][FuelAmount] -1000;
                         return 1;
                     }
                }
return 0;
}
That's how you would do it if you had no more commands in strcmp.
But if there is more then just use return 1;
Reply
#10

Well this how i did it xD

Код:
	    if(strcmp("/extract", cmdtext, true, 5) == 0)
		{
        if(PlayerInfo[playerid][FuelAmount] < 1000)
		{
		return SendClientMessage(playerid, RED, "[ATT]: You Dont Have Enough Fuel For This To Be Delivered!)");
        }
        new Float:x, Float:y, Float:z, Float:az;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, az);
        CreateVehicle(469, x+5, y+5, z, az, -1, -1, 180);
		SendClientMessage(playerid, RED, "[ATT]: Extraction Has Arrived! (Cost: 1000 Fuel To Deliver)");
		PlayerInfo[playerid][FuelAmount] = PlayerInfo[playerid][FuelAmount] -1000;
        return 1;
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)