public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/coin", cmdtext, true, 10) == 0)
{
new str[150];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "{0780E3}%s flips the coin and lands it on((heads||tails))", str);
SendClientMessageToAll(-1,str);
return 1;
}
return 0;
}
if( strcmp( cmdtext, "/coin", cmdtext, true ) == 0 ) { new str[ 128 ]; GetPlayerName( playerid, str, MAX_PLAYER_NAME ); switch( random( 2 ) ) { case 0: format( str, 128, "%s flips the coin and lands it on heads", str ); case 1: format( str, 128, "%s flips the coin and lands it on tails", str ); } SendClientMessageToAll( 0x0780E3FF, str ); return 1; }
#define conv(%0,%1,%2) ((!%0) ? (%1) : (%2))
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/coin", cmdtext, true) == 0)
{
new str[150];
static result;
result %= 2;
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "{0780E3}%s flips the coin and lands it on %s", str,conv(result,"heads","tails"));
SendClientMessageToAll(-1,str);
result++;
return 1;
}
return 0;
}
How can I do it like if I do /coin the result is random.Like if I do /coin it appears heads,and the second time I do it is also random like no one knows that what is the result,it might come tails or heads.
|
if( strcmp( cmdtext, "/coin", cmdtext, true ) == 0 )
{
new str[ 128 ];
GetPlayerName( playerid, str, MAX_PLAYER_NAME );
switch( random( 2 ) )
{
case 0: format( str, 128, "%s flips the coin and lands it on heads", str );
case 1: format( str, 128, "%s flips the coin and lands it on tails", str );
}
SendClientMessageToAll( 0x0780E3FF, str );
return 1;
}
ProxDetector(10.0, playerid, str, COLOR_PINK, COLOR_PINK, COLOR_PINK, COLOR_PINK, COLOR_PINK);
C:\Users\TaLhA XIV\Desktop\Pawno scripter\filterscripts\dice.pwn(104) : error 017: undefined symbol "ProxDetector"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.