Need some help with command /random -
zwartebanaan - 06.02.2009
hello i got a quistion how can i say something random like this:
i type /random
then it says on the server [Hippie]:/hit 1 1000
i do it again /random
then it says on the server [Hippe]:/hit 6 1000
i do it again /random
then it says on the server [Hippe]:/hit 3 1000
i got this already but i the player must say it not the server....
need some help for it

thank you already
if (strcmp("/random", cmdtext, true, 10) == 0)
{
if(IsPlayerAdmin(playerid)==1)
{
new hit = random(14);
if(hit == 1)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 1 1000");
}
else if(hit == 2)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 2 1000");
}
else if(hit == 3)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 3 1000");
}
else if(hit == 4)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 4 1000");
}
else if(hit == 5)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 5 1000");
}
else if(hit == 6)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 6 1000");
}
else if(hit == 7)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 7 1000");
}
else if(hit ==

{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 8 1000");
}
else if(hit == 9)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 9 1000");
}
else if(hit == 10)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 10 1000");
}
else if(hit == 11)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 11 1000");
}
else if(hit == 12)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 12 1000");
}
else if(hit == 13)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 13 1000");
}
else if(hit == 14)
{
SendClientMessage(playerid, 0xFFFFFFAA, "/hit 14 1000");
}
return 1;
}
}
Re: Need some help with command /random -
Auto-Sized - 06.02.2009
pawn Код:
random(14);//will create a number between 0-13.
https://sampwiki.blast.hk/wiki/Random
http://forum.sa-mp.com/index.php?top...0635#msg570635
https://sampwiki.blast.hk/wiki/Format
thanks ssǝן‾ʎ should have posted that as well.
I think thats what you mean adapt it for your needs.
Re: Need some help with command /random -
zwartebanaan - 06.02.2009
sendmessagetoall is not good, but how can i say it not true the server but true the player [playername]: hallo not server:hello
Re: Need some help with command /random -
CracK - 06.02.2009
pawn Код:
if (strcmp("/random", cmdtext, true, 10) == 0)
{
if(IsPlayerAdmin(playerid))
{
new str[128];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
new hit = random(14);
format(str,sizeof(str),"%s:/hit %d 1000",playername,hit);
SendClientMessageToAll(0xFFFFFFAA,str);
}
return 1;
}
This should work
Re: Need some help with command /random -
Streetplaya - 06.02.2009
i think he needs SendPlayerMessageToAll
Re: Need some help with command /random -
MenaceX^ - 06.02.2009
Quote:
|
Originally Posted by !MaVe
i think he needs SendPlayerMessageToAll
|
He did it.
pawn Код:
if (strcmp("/random", cmdtext, true, 10) == 0)
{
if(IsPlayerAdmin(playerid)==1)
{
new str[128];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
new hit = random(14);
format(str,sizeof(str),"%s:/hit %d 1000",playername,hit);
SendClientMessageToAll(0xFFFFFFAA,str);
}
return 1;
}
Re: Need some help with command /random -
Streetplaya - 06.02.2009
not SendClientMessageToAll, Send
PlayerMessageToAll
Re: Need some help with command /random -
CracK - 06.02.2009
Quote:
|
Originally Posted by !MaVe
not SendClientMessageToAll, SendPlayerMessageToAll
|
Send
PlayerMessageToAll will look like this,won't it?:
PM from 'playername here'(his id):/hit 'value' 1000
Re: Need some help with command /random -
Streetplaya - 06.02.2009
Quote:
|
Originally Posted by CracKman
Quote:
|
Originally Posted by !MaVe
not SendClientMessageToAll, SendPlayerMessageToAll
|
Send PlayerMessageToAll will look like this,won't it?:
PM from 'playername here'(his id):/hit 'value' 1000
|
No, it will send a default chat message.
Re: Need some help with command /random -
CracK - 06.02.2009
pawn Код:
if (strcmp("/random", cmdtext, true, 10) == 0)
{
if(IsPlayerAdmin(playerid)==1)
{
new str[128];
new hit = random(14);
format(str,sizeof(str),"/hit %d 1000",hit);
SendPlayerMessageToAll(playerid,str);
return 1;
}
return 0;
}
Hm, really it sends a default chat message...I will take it into a count.