new value = random(2); new string1[128]; new Float:RandomSpawn[][2] = { {"%s flipped a coin! landed on heads"}; {"%s flipped a coin! landed on tails"}; };
if (strcmp("/coin", cmdtext, true, 10) == 0) { new name[128]; new string[128]; GetPlayerName(playerid,name,128); format(string, sizeof(name), RandomSpawn[0], RandomSpawn[1], GetPlayerName); SendClientMessageToAll(0xA586B8FF, name); return 1; }
C:\Users\PC1\Desktop\CZCNRSF\CZCNRSF\CNRSF\filterscripts\flipcoin.pwn(122) : error 017: undefined symbol "RandomSpawn" C:\Users\PC1\Desktop\CZCNRSF\CZCNRSF\CNRSF\filterscripts\flipcoin.pwn(122) : warning 215: expression has no effect C:\Users\PC1\Desktop\CZCNRSF\CZCNRSF\CNRSF\filterscripts\flipcoin.pwn(122) : error 001: expected token: ";", but found "]" C:\Users\PC1\Desktop\CZCNRSF\CZCNRSF\CNRSF\filterscripts\flipcoin.pwn(122) : error 029: invalid expression, assumed zero C:\Users\PC1\Desktop\CZCNRSF\CZCNRSF\CNRSF\filterscripts\flipcoin.pwn(122) : fatal error 107: too many error messages on one line
Its not going like that m8..
Read this https://sampforum.blast.hk/showthread.php?tid=581106 BUT READ DON'T COPY-PASTE |
stock GetCoilFlip(playerid)
{
new string[64], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new coinflip;
coinflip = random(2);//only two cases occur here and thats 0 and 1
if(coinflip == 0)
{
format(string,sizeof(string),"%s flipped a coin! landed on heads",playername);
}
else
{
format(string,sizeof(string),"%s flipped a coin! landed on tails",playername);
}
return string;
SendClientMessage(playerid, 0xAFAFAFAA, GetCoilFlip(playerid));
or
SendClientMessageToAll(0xAFAFAFAA, GetCoilFlip(playerid));
if (strcmp("/coin", cmdtext, true) == 0)
{
new p_name[MAX_PLAYER_NAME], string[57];
GetPlayerName(playerid, p_name, sizeof p_name);
format(string, sizeof string, "%s flipped a coin! landed on %s", p_name, !random(2) ? ("heads") : ("tails"));
SendClientMessageToAll(0xA586B8FF, string);
return 1;
}
GetName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}