Player ID's - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Player ID's (
/showthread.php?tid=515527)
Player ID's -
ShoortyFl - 26.05.2014
I was wondering how can i detect if the player ID is odd or even, if it's odd it does some function, and if it's even it does some function too.. ?
Re: Player ID's -
Riddick94 - 26.05.2014
http://forum.sa-mp.com/showpost.php?...postcount=4323
pawn Код:
if(IsNumberOdd(playerid))
{
// Do whatever you want when the player id is odd.
}
else
{
// When the number is even.
}
Re : Player ID's -
S4t3K - 26.05.2014
PHP код:
stock bool:IsEven(number)
{
new array[150];
valstr(array, number);
for(new i = 0; i < sizeof(array); i++)
{
if(i != sizeof(array)) continue;
switch(var[i])
{
case 0, 2, 4, 6, 8: return true;
default: return false;
}
}
}
Re: Player ID's -
NaClchemistryK - 26.05.2014
delete
Re: Player ID's -
Rittik - 26.05.2014
Код:
if(playerid%2==0)
{
SendClientMessage(playerid,-1,"Even");
}
else
{
SendClientMessage(playerid,-1,"Odd");
}