07.01.2010, 22:07
Or perhaps just..
?
pawn Код:
if (string[strlen(string)-1] == 's')
{
// 's' character at the end
}
if (string[strlen(string)-1] == 's')
{
// 's' character at the end
}
new len = GetPlayerName(playerid, playername, sizeof(playername));
if (name[len-1] == 's')
{
// ....
}
stock IntToFormattedStr(integer)
{
// By Zamaroht
new value[20], string[20];
valstr(value, integer);
new charcount;
for(new i = strlen(value); i >= 0; i --)
{
format(string, sizeof(string), "%c%s", value[i], string);
if(charcount == 3)
{
if((integer >= 0 && i != 0) || (integer < 0 && i > 1))
format(string, sizeof(string), ",%s", string);
charcount = 0;
}
charcount ++;
}
return string;
}
stock Cenzura(string[],word[],destch='*')
{
new start_index=(-1),
end_index=(-1);
start_index=strfind(string,word,true);
if(start_index==(-1)) return false;
end_index=(start_index+strlen(word));
for( ; start_index<end_index; start_index++) string[start_index]=destch;
return true;
}
new string[32]="testing the function";
#include <a_samp>
#define MAX_LEN 32
#define MAX_ENTRY 120
#define SOURCE "cenzura.txt"
static Cenzuralt_Szo[MAX_ENTRY][MAX_LEN];
public OnFilterScriptInit() {
if(!fexist(SOURCE)) return false;
new File:myFile,
line[MAX_LEN],
index=0;
myFile=fopen(SOURCE,filemode:io_read);
while(fread(myFile,line,sizeof line) && (index != MAX_ENTRY)) {
if(strlen(line)>MAX_LEN) continue;
StripNewLine(line);
strmid(Cenzuralt_Szo[index],line,0,strlen(line),sizeof line);
index++;
}
return true;
}
public OnPlayerText(playerid,text[])
{
for(new i=0; i<MAX_ENTRY; i++) if(!Cenzuralt_Szo[i][0]) continue;else Cenzura(text,Cenzuralt_Szo[i]);
return true;
}
stock StripNewLine(str[]) // ysi-misc.own
{
new
l = strlen(str);
while (l-- && str[l] <= ' ') str[l] = '\0';
}
stock Cenzura(string[],word[],destch='*')
{
new start_index=(-1),
end_index=(-1);
start_index=strfind(string,word,true);
if(start_index==(-1)) return false;
end_index=(start_index+strlen(word));
for( ; start_index<end_index; start_index++) string[start_index]=destch;
return true;
}
gay shit fuck
Originally Posted by Finn
if(a>316&&a<45)
How can a be over 316 and under 45 at the same time? |
//for easier usage
#define North (1)
#define East (2)
#define South (3)
#define West (4)
stock GetNESW(playerid)
{
new Float:angle;
if(!GetPlayerFacingAngle(playerid, angle)) return 0;
else if(angle >= 315.0) return North;
else if(angle >= 225.0) return West;
else if(angle >= 125.0) return South;
else if(angle >= 45.0) return East;
else return North;
}
Originally Posted by ♣ Joker ♠
Quote:
North (0°) /\ West (270°) <-|-> East (90°) \/ South (180°) and there arent that much checks needed, 4 would be enough pawn Код:
pawn Код:
|
if(!GetPlayerFacingAngle(playerid, angle)) return North;
if(!GetPlayerFacingAngle(playerid, angle)) return North;
if(angle == 0)
GetVehicleMaxSeats(vehicleid)
{
if(GetVehicleModel(vehicleid)) return VehicleSeats[modelid - 400];
else return 0;
}
GetVehicleMaxSeats(vehicleid)return (GetVehicleModel(vehicleid)) ? (VehicleSeats[modelid - 400]) : (0);
Originally Posted by dice7
GetVehicleMaxSeats(vehicleid)
{ if(GetVehicleModel(vehicleid)) return VehicleSeats[modelid - 400]; else return 0; } |
Originally Posted by BlackFoX_UD_
GetVehicleMaxSeats(vehicleid) return (GetVehicleModel(vehicleid)) ? (VehicleSeats[modelid - 400]) : (0);
|
stock GetVehicleMaxSeats(vehicleid)
return ((vehicleid = GetVehicleModel(vehicleid)) ? VehicleSeats[vehicleid - 400] : (0));
(vehicleid = GetVehicleModel(vehicleid)
Originally Posted by BlackFoX_UD_
vehicleid isnt the Model of Vehicle
Код:
(vehicleid = GetVehicleModel(vehicleid) |
stock GetVehicleMaxSeats(vehicleid)
if((vehicleid = GetVehicleModel(vehicleid))) return VehicleSeats[vehicleid - 400]; else return 0;
stock GetVehicleMaxSeats(vehicleid) {
vehicleid = GetVehicleModel(vehicleid);
if(vehicleid) return VehicleSeats[vehicleid - 400];
else return 0;
}
stock GetVehicleMaxSeats(var)
if((var = GetVehicleModel(var))) return VehicleSeats[var - 400]; else return 0;
new PlayerName[MAX_PLAYERS][MAX_PLAYER_NAME]; //To upper
GetPlayerName(playerid, PlayerName[playerid], MAX_PLAYER_NAME); //to OnPlayerConnect
Originally Posted by S2D.Alone_ (RU)
Alternate of Playername(playerid);
pawn Код:
format(string, sizeof(string), "%s has blowed up", PlayerName[playerid]); |
stock PlayerName(playerid)
{
new
name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
format(string, sizeof(string), "%s", PlayerName(playerid));
Originally Posted by Don Correlli
Quote:
pawn Код:
|
Originally Posted by ♣ Joker ♠
There is always the memory wasting way which is usually faster and the normal way
And he said "Alternate of PlayerName(playerid);" |
Originally Posted by Don Correlli
Quote:
|
Originally Posted by Don Correlli
You can script that in a less than a minute.
|
Originally Posted by Don Correlli
You can script that in a less than a minute.
|
Originally Posted by Don Correlli
You can script that in a less than a minute.
|
Originally Posted by S2D.Alone_ (RU)
Alternate of Playername(playerid);
pawn Код:
format(string, sizeof(string), "%s has blowed up", PlayerName[playerid]); |
#define PlayerName(%1) PlayerName[%1]