[Tutorial] Function Type Explanation (stock, public, plain)
#4

pawn Код:
stock UserPath(playerid)
{
    new
        name[24],
        string[50]
    ;
    GetPlayerName(playerid, name, 24);
    format(string, 50, USER_PATH, name);
    return string; // publics can't do this
}
stock ProxDetector(Float:radi, playerid, string[],color)
{
    new Float:x,Float:y,Float:z;
    GetPlayerPos(playerid,x,y,z);
    foreach(Player,i)
    {
        if(!IsPlayerConnected(i))continue;
        if(IsPlayerInRangeOfPoint(i,radi,x,y,z)) SendClientMessage(i,color,string);
    } // stocks can go without returning a value
       // publics, you have to return a value
}
stock ClearChat(playerid)
{
    for(new j=0;j<50;j++)
    {
        SendClientMessage(playerid,COLOR_WHITE,"");
    }
    return 1;
}
stock GetName(playerid)
{
    new string[MAX_PLAYER_NAME];
    GetPlayerName(playerid,string,sizeof(string));
    strreplace(string,'_',' ');
    return string; // publics can't do this
}
stock strreplace(string[], find, replace)
{
    for(new i=0; string[i]; i++)
    {
        if(string[i] == find)
        {
            string[i] = replace;
        }
    }
}
stock GetXYInfrontOfPlayer(playerid,&Float:x,&Float:y,Float:Distance)
{
    new Float:r;
    if(IsPlayerInAnyVehicle(playerid)==0)GetPlayerFacingAngle(playerid,r);
    else GetVehicleZAngle(GetPlayerVehicleID(playerid),r);
    x += (Distance * floatsin(-r, degrees));
    y += (Distance * floatcos(-r, degrees));
    return 1;
}
Stocks are useless my ass. Think before you post.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)