2 questions, please =s:
#1

I've tried a warning for something, like:

first 1/3
second 2/3
third 3/3 (message and kick the player, but it didn't work) [I deleted this code due a bug which crashed]


2є How to detect player IP on a string? cuz I tried to do it on OnPlayerConnect, and doesn't shows

I did this code as well:
Код:
New ip[16],string[128];
GetPlayerIp(playerid, ip, 16);
format(string,sizeof(string),"%i", ip);
Return SendClientMessageToAll(red, string);
THanks for any help

PS: Also coordinates bugs with this string, when I did a save spawn command, for return a message with chose coordinates, and gave me "unknown command" [It's like same thing on the IP question]
Reply
#2

format(string,sizeof(string),"%s", ip);
I gues this works.

Show my your cmd
Reply
#3

"%i" means that it'll insert an integer, however an IP adress is a string so you'll need to use "%s"
Reply
#4

Hiddos is so right cuz the ip is a string not integar
Reply
#5

Dude, that's about ip is resolved: just had to change %d or %i [dont remember which I used] for %s.

About the warning for something I dont know how to do, tried with

Код:
new fun[MAX_PLAYERS];

etc....

If fun[playerid]=1;  return SendClientMessage(playerid, red, "2/3");
fun2[playerid]=1;
Dont know really how to do =s

thx
Reply
#6

if(fun[playerid]) return SendClientMessage(playerid,red,"2/3");
Reply
#7

Sorry, couldn't log the day all lol. Now tonight, I tried one as kaleotter told, but progressivally:

Код:
if(strcmp("/warnx",cmdtext, true, 10) == 0)
   {
   new warn1[MAX_PLAYERS],warn2[MAX_PLAYERS],warn3[MAX_PLAYERS];
   if(warn1[playerid]=0)
   {
   return SendClientMessage(playerid, vermelho,"1/3");
   warn1[playerid]=1;
   }
   if(warn1[playerid]=1)
   {
   return SendClientMessage(playerid, vermelho, "2/3");
   warn2[playerid]=1;
   }
   if(warn2[playerid]=1)
   {
   return SendClientMessage(playerid, vermelho, "3/3");
   Kick(playerid);
   }

   return 1;
   }
It stucks on "2/3"
=d
Reply
#8

id go something like this
PHP код:
if(strcmp("/warnx",cmdtexttrue10) == 0){
    
SetPVarInt(playerid,"warnx",GetPVarInt(playerid,warnx)++);
       if(
GetPVarInt(playerid,"warnx") == 1)return SendClientMessage(playeridvermelho,"1/3");
    else if(
GetPVarInt(playerid,"warnx") == 2)return SendClientMessage(playeridvermelho"2/3");
       else if(
GetPVarInt(playerid,"warnx") >= 3){
           
SendClientMessage(playeridvermelho"3/3");
           
Kick(playerid);
           
SetPVarInt(playerid,"warnx",0);
       }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)