stock CreateRandomNumberPlate(vehicleid)
{
new
string[8]
;
format(string, sizeof(string), "NUM-%d", (vehicleid + 1000));
SetVehicleNumberPlate(vehicleid, string);
SetVehicleToRespawn(vehicleid);
return vehicleid;
}
IsPlayerStopped(playerid)
{
if(GetPlayerAnimationIndex(playerid) == 1189) return true;
return false;
}
stock CreateVehicleNumberPlate(vehicleid)
{
static
sPlate[22];
format(sPlate,22,"Plate: %d",(1000 + vehicleid));
SetVehicleNumberPlate(vehicleid,sPlate);
return SetVehicleToRespawn(vehicleid);
}
stock
GivePVarInt(playerid, var[], val) //- PVars++
return SetPVarInt(playerid,var,GetPVarInt(playerid, var)+val);
stock
CrashPlayer(playerid) //- Crash the Player (0.3b)
SetPlayerHoldingObject(playerid, 0, 0);
stock
GetIDFromName(part[]) //Geta id from part of nome
{
static
namep[24]
;
for(new id; id < MAX_PLAYERS; id++)
{
GetPlayerName(i,namep,24);
if(!strfind(namep,part, true)) return id;
}
return -1;
}
(I already made the first one though, not sure if I posted it in the topic or not).
//**** Change here for version of servers
#define ServerVersion 1 // 0 = 0.3a | 1 = 0.3b | 2 = 0.3c
// here the includes
#if ServerVersion == 0
#include "../Includes0.3a/a_samp.inc" // others includes 0.3a \/
#endif
#if ServerVersion == 1
#include "../Includes0.3b/a_samp.inc" // others includes 0.3b \/
#endif
#if ServerVersion == 2
#include "../Includes0.3c/a_samp.inc" // others includes 0.3a \/
#endif
stock GetBiggestArrayNumber(array[], len = sizeof(array))
{
new
biggest = cellmin
;
for(new i ; i != len; ++i)
{
if(array[i] > biggest)
{
biggest = array[i];
}
}
return biggest;
}
stock GetSmallestArrayNumber(array[], len = sizeof(array))
{
new
smallest = cellmax
;
for(new i ; i != len; ++i)
{
if(array[i] < smallest)
{
smallest = array[i];
}
}
return smallest;
}
#define sLoop(%0,%1) for(new %1; %0[%1]; ++%1)
sLoop(string,i)
{
printf("Char %s",string[i]);
}
stock GetNumArgs(var[], ...)
{
for(new i = 1; i != numargs(); ++i)
{
var[(i - 1)] = getarg(i);
}
return 1;
}
new
var[4]
;
GetNumArgs(var, 1, 5, 9, 4);
printf("Numbers stored in array var are: %d %d %d %d", var[0], var[1], var[2], var[3]);
Numbers stored in array var are 1 5 9 4
stock GetStringArgs(string[][], ...)
{
for(new i = 1; i != numargs(); ++i)
{
for(new x; getarg(i, x) != 0; ++x)
{
string[(i - 1)][x] = getarg(i, x);
}
}
return 1;
}
new
string[4][16]
;
GetStringArgs(string, "My", "Nick", "Is", "RyDeR`");
printf("Strings stored in 2D array string are: %s %s %s %s", string[0], string[1], string[2], string[3]);
Strings stored in 2D array string are: My Nick Is RyDeR`
|
Loop String
Use:pawn Код:
pawn Код:
Simple loop for string (best for not use strlen) |
for(new i; i != strlen(string); ++i)
for(new i, j = strlen(string); i != j; ++i)
for( new i = 0, j = strlen( string ); i < j; i++ )
while (i <10) if (string [i]! = EOS)
stock GetBiggestArrayNumber(array[], len = sizeof(array))
{
new biggest=-2147483647;
for(new i=0; i != len; ++i)
if(array[i] > biggest)
biggest = array[i];
return biggest;
}
stock GetSmallestArrayNumber(array[], len = sizeof(array))
{
new smallest=2147483647;
for(new i; i != len; ++i)
if(array[i] < smallest)
smallest = array[i];
return smallest;
}