Pongo unas funciones que cree:
pawn Код:
stock TeleportPlayer(playerid, Float:x,Float:y,Float:z,interior,mundo)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new vid = GetPlayerVehicleID(playerid);
SetVehiclePos(vid,x,y,z);
LinkVehicleToInterior(vid, interior);
SetVehicleVirtualWorld(vid, mundo);
} else {
SetPlayerPos(playerid,x,y,z);
}
SetPlayerInterior(playerid,interior);
SetPlayerVirtualWorld(playerid,mundo);
}
Antiflood de ips
La funcion de is numeric y el split no son mias pero sin esas no funciona
pawn Код:
forward split(const strsrc[], strdest[][], delimiter);
stock BuscarIPs(mensaje[])
{
new encontrados;
new Parte[30][64];
split(mensaje, Parte, '.');
for(new i = 1; i < 5; i++)
{
if(IsNumeric(Parte[i]))
{
encontrados ++;
}
}
if(encontrados >= 2)
{
return 1;
}
return 0;
}
stock IsNumeric(const string[])
{
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++)
{
if (
(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
|| (string[i]=='-' && i!=0) // A '-' but not at first.
|| (string[i]=='+' && i!=0) // A '+' but not at first.
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
return true;
}
public split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc))
{
if(strsrc[i]==delimiter || i==strlen(strsrc))
{
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
ejemplo:
pawn Код:
public OnPlayerText(playerid, text[])
{
if(BuscarIPs(text))
{
SendClientMessage(playerid,COLOR_WHITE, "* No envies ip");
return 0;
}
}