SA-MP Forums Archive
2 questions, please =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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 2 questions, please =s: (/showthread.php?tid=187609)



2 questions, please =s: - blackwave - 03.11.2010

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]


Re: 2 questions, please =s: - KaleOtter - 03.11.2010

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

Show my your cmd


Re: 2 questions, please =s: - Hiddos - 03.11.2010

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


Re: 2 questions, please =s: - MBX97 - 03.11.2010

Hiddos is so right cuz the ip is a string not integar


Re: 2 questions, please =s: - blackwave - 03.11.2010

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


Re: 2 questions, please =s: - KaleOtter - 04.11.2010

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


Re: 2 questions, please =s: - blackwave - 04.11.2010

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


Re: 2 questions, please =s: - (SF)Noobanatior - 04.11.2010

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;