+Reps , how to (SMall help)
#1

Hello , how can i add msg that checks if the player running R1 SAMP , so if he running r1 0.3x he got auto kick reason please update ur samp !
Reply
#2

Use GetPlayerVersion and strcmp
Reply
#3

pawn Код:
public OnPlayerConnected(playerid)
{
     new version[40];
     GetPlayerVersion(playerid,version,sizeof(version));
     if(strcmp(version,"0.3x",false)) == true)
     {
          KickWithMessage(playerid,"Please download the latest version of SA-MP");
     }
     return 1;
}

// If you don't have KickWithMessage, then copy this at the end of your .pwn file.
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }

KickWithMessage(playerid, message[])
{
    SendClientMessage(playerid, COLOR_RED, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);
}
Reply
#4

Quote:
Originally Posted by Tayab
Посмотреть сообщение
pawn Код:
public OnPlayerConnected(playerid)
{
     new version[40];
     GetPlayerVersion(playerid,version,sizeof(version));
     if(strcmp(version,"0.3x",false)) == true)
     {
     KickWithMessage(playerid,"Please download the latest version of SA-MP");
     return 1;
      }
      return 1;
}

// If you don't have KickWithMessage, then copy this at the end of your .pwn file.
forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }

KickWithMessage(playerid, message[])
{
    SendClientMessage(playerid, COLOR_RED, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);
}
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(2236) : error 029: invalid expression, assumed zero
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(2236) : warning 215: expression has no effect
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(2236) : error 001: expected token: ";", but found ")"
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(2236) : error 029: invalid expression, assumed zero
C:\Users\MaHdy\Desktop\SPA Server original\gamemodes\SPA.pwn(2236) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

Please help !
Reply
#6

pawn Код:
public OnPlayerConnect(playerid)
{
    new version[40];
    GetPlayerVersion(playerid,version,sizeof(version));
    if(strcmp(version,"0.3x",false)) == true)
    {
        KickForMessageDelay(playerid);
        SendClientMessage(playerid, 0xFF0000FF, "Please download the latest version of SA-MP!");
    }
    return 1;
}
stock KickForMessageDelay(playerid)
{
    SetTimerEx("AKick",500,false,"i",playerid);
    return 1;
}
forward AKick(playerid);
public AKick(playerid)
{
    Kick(playerid);
    return 1;
}
try this
Reply
#7

Quote:
Originally Posted by BlackWolf120
Посмотреть сообщение
pawn Код:
public OnPlayerConnect(playerid)
{
    new version[40];
    GetPlayerVersion(playerid,version,sizeof(version));
    if(strcmp(version,"0.3x",false)) == true)
    {
        KickForMessageDelay(playerid);
        SendClientMessage(playerid, 0xFF0000FF, "Please download the latest version of SA-MP!");
    }
    return 1;
}
stock KickForMessageDelay(playerid)
{
    SetTimerEx("AKick",500,false,"i",playerid);
    return 1;
}
forward AKick(playerid);
public AKick(playerid)
{
    Kick(playerid);
    return 1;
}
try this
You know this protecting ur server from bots attackers thanks. i will try
Reply
#8

pawn Код:
if(strcmp(version,"0.3x",false))
    {
        KickWithMessage(playerid,"Please download the latest version of SA-MP");
        return 1;
    }
Fixed mine.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)