PDA

View Full Version : How create command for random stuffs


henkas
09/10/2016, 04:58 PM
Hello guys!
I have question how should i create cmd command who give you random stuff like (Skins,gun,hp and others) when i type /test i got one that stuff. And i can do it only per 200sec.

BiosMarcel
09/10/2016, 05:04 PM
Wrong section , we are helping here, ot give any tutorials or script for you

X445
09/10/2016, 05:12 PM
Hey Henkas!
First Download ZCMD it will let Creating Command Easy Download-ZCMD (http://forum.sa-mp.com/showthread.php?t=91354)
After Copy The zcmd.inc to Your Pawno>includes There paste it,

Now Go open Pawno File then open the Pawno Application, Open new and Lets Start:

Steps:

#include <a_samp>
#include <zcmd>

CMD:healme(playerid,params[])
{
SetPlayerHealth(100);
SendClientMessage(playerid,0x000000FF, "You've Been Healed by Health System");
GameTextForPlayer(playerid,"~B~HEALED!",3000,5);
return 1;
}

CMD:gun(playerid,params[])
{
GivePlayerWeapon(playerid,34,200);
return 1;
}
//Write The Weapon id What you want and Write The Ammount How much You Want it

And You Can More Like this... :D Hope that i helped you ;)

azzerking
09/10/2016, 05:19 PM
X445 I think you mis-read what he wanted.

He wants to be able to type a command /test, and it will randomly give him different stuff.

here is an example.


CMD:test( playerid, params[] )
{
new rand = Random( 11 );

switch( rand )
{
case 0 .. 2: // if rand is between 0 and 2 then run the code here
{
// Give Money Here
}

case 3 .. 5: // if rand is between 3 and 5 then run the code here
{
// Give Weapons Here
}

case 6 .. 8: // if rand is between 6 and 8 then run the code here
{
// Give Health or Armour
}

case 9 .. 11: // if rand is between 9 and 11 then run the code here
{
// Change Skin
}

}

return 1;
}


I hope this is what you wanted, feel free to reply if you are still having issues.

henkas
09/10/2016, 05:41 PM
X445 I think you mis-read what he wanted.

He wants to be able to type a command /test, and it will randomly give him different stuff.

here is an example.


CMD:test( playerid, params[] )
{
new rand = Random( 11 );

switch( rand )
{
case 0 .. 2: // if rand is between 0 and 2 then run the code here
{
// Give Money Here
}

case 3 .. 5: // if rand is between 3 and 5 then run the code here
{
// Give Weapons Here
}

case 6 .. 8: // if rand is between 6 and 8 then run the code here
{
// Give Health or Armour
}

case 9 .. 11: // if rand is between 9 and 11 then run the code here
{
// Change Skin
}

}

return 1;
}


I hope this is what you wanted, feel free to reply if you are still having issues.

Yup bro thats what i need. Thanks (y)

henkas
09/10/2016, 06:20 PM
Amm i got error

error 017: undefined symbol "Random"

Konstantinos
09/10/2016, 06:23 PM
It is random (lower case).

By the way random(11) will give a random number between 0-10 so in the last case it won't be 9 to 11.

azzerking
09/10/2016, 06:25 PM
Oh, god your so right.

I realized that not long after I replied, but I was dealing with another thread so I did not reply.

your right though. :)

henkas
09/10/2016, 06:38 PM
X445 I think you mis-read what he wanted.

He wants to be able to type a command /test, and it will randomly give him different stuff.

here is an example.


CMD:test( playerid, params[] )
{
new rand = Random( 11 );

switch( rand )
{
case 0 .. 2: // if rand is between 0 and 2 then run the code here
{
// Give Money Here
}

case 3 .. 5: // if rand is between 3 and 5 then run the code here
{
// Give Weapons Here
}

case 6 .. 8: // if rand is between 6 and 8 then run the code here
{
// Give Health or Armour
}

case 9 .. 11: // if rand is between 9 and 11 then run the code here
{
// Change Skin
}

}

return 1;
}


I hope this is what you wanted, feel free to reply if you are still having issues.

It is random (lower case).

By the way random(11) will give a random number between 0-10 so in the last case it won't be 9 to 11.
Omg i haven't saw this :DD thanks.