Skip to content
Kiss Attila edited this page Jul 29, 2014 · 27 revisions

Welcome to the YSF Wiki. Documenting new functions and callbacks in YSF Plugin for San Andreas Multiplayer mod.

Latest release: R8 (In Beta)

YSF Callbacks:

Callbacks

  • OnPlayerEnterGangZone(playerid, zoneid);
  • OnPlayerLeaveGangZone(playerid, zoneid);
  • OnPlayerEnterPlayerGangZone(playerid, zoneid);
  • OnPlayerLeavePlayerGangZone(playerid, zoneid);
  • OnPlayerPauseStateChange(playerid, pausestate);

YSF Functions:

File functions

  • ffind(const pattern[], filename[], len, &idx);
  • frename(const oldname[], const newname[]);

Directory functions

  • dfind(const pattern[], filename[], len, &idx);
  • dcreate(const name[]);
  • drename(const oldname[], const newname[]);

Server rule and other functions

  • SetModeRestartTime(Float:time);
  • Float:GetModeRestartTime();
  • SetMaxPlayers(maxplayers);
  • SetMaxNPCs(maxnpcs);
  • SetPlayerAdmin(playerid, bool:admin);
  • LoadFilterScript(scriptname[]);
  • UnLoadFilterScript(scriptname[]);
  • GetFilterScriptCount();
  • GetFilterScriptName(id, name[], len = sizeof(name));
  • AddServerRule(name[], value[], flags = CON_VARFLAG_RULE);
  • SetServerRule(name[], value[]);
  • ModifyFlag(name[], flags);

Nickname

  • IsValidNickName(name[]);
  • AllowNickNameCharacter(character, bool:allow);
  • IsNickNameCharacterAllowed(character);

Classes

  • GetAvailableClasses();
  • GetPlayerClass(classid, &teamid, &modelid, &Float:spawn_x, &Float:spawn_y, &Float:spawn_z, &Float:z_angle, &weapon1, &weapon1_ammo, &weapon2, &weapon2_ammo,& weapon3, &weapon3_ammo);
  • EditPlayerClass(classid, teamid, modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:z_angle, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo);

Timers

Per player

  • SetPlayerGravity(playerid, Float:gravity);
  • Float:GetPlayerGravity(playerid);
  • SetPlayerTeamForPlayer(forplayerid, playerid, teamid);
  • GetPlayerTeamForPlayer(forplayerid, playerid);
  • GetPlayerWeather(playerid);
  • TogglePlayerWidescreen(playerid, bool:set);
  • IsPlayerWidescreenToggled(playerid);
  • GetSpawnInfo(playerid, &teamid, &modelid, &Float:spawn_x, &Float:spawn_y, &Float:spawn_z, &Float:z_angle, &weapon1, &weapon1_ammo, &weapon2, &weapon2_ammo,& weapon3, &weapon3_ammo);
  • GetPlayerSkillLevel(playerid, skill);
  • GetPlayerCheckpoint(playerid, &Float:fX, &Float:fY, &Float:fZ, &Float:fSize);
  • GetPlayerRaceCheckpoint(playerid, &Float:fX, &Float:fY, &Float:fZ, &Float:fNextX, &Float:fNextY, &fNextZ, &Float:fSize);
  • GetPlayerWorldBounds(playerid, &Float:x_max, &Float:x_min, &Float:y_max, &Float:y_min);
  • IsPlayerInModShop(playerid);
  • GetPlayerSirenState(playerid);
  • GetPlayerLandingGearState(playerid);
  • GetPlayerHydraReactorAngle(playerid);
  • Float:GetPlayerTrainSpeed(playerid);
  • Float:GetPlayerZAim(playerid);
  • GetPlayerSurfingOffsets(playerid, &Float:fOffsetX, &Float:fOffsetY, &Float:fOffsetZ);
  • GetPlayerRotationQuat(playerid, &Float:w, &Float:x, &Float:y, &Float:z);
  • GetPlayerDialogID(playerid);
  • GetPlayerSpectateID(playerid);
  • GetPlayerSpectateType(playerid);
  • SendBulletData(sender, hitid, hittype, Float:fHitOriginX, Float:fHitOriginY, Float:fHitOriginZ, Float:fHitTargetX, Float:fHitTargetY, Float:fHitTargetZ, Float:fCenterOfHitX, Float:fCenterOfHitY, Float:fCenterOfHitZ, forplayerid = -1);
  • ShowPlayerForPlayer(forplayerid, playerid);
  • HidePlayerForPlayer(forplayerid, playerid);

Scoreboard manipulation

  • TogglePlayerScoresPingsUpdate(playerid, bool:toggle);
  • TogglePlayerFakePing(playerid, bool:toggle);
  • SetPlayerFakePing(playerid, ping);

Pause functions

  • IsPlayerPaused(playerid);
  • GetPlayerPausedTime(playerid);

Objects get - global

  • GetObjectModel(objectid);
  • Float:GetObjectDrawDistance(objectid);
  • SetObjectMoveSpeed(objectid, Float:fSpeed);
  • Float:GetObjectMoveSpeed(objectid);
  • GetObjectTarget(objectid, &Float:fX, &Float:fY, &Float:fZ);
  • GetObjectAttachedData(objectid, &attached_vehicleid, &attached_objectid);
  • GetObjectAttachedOffset(objectid, &Float:fX, &Float:fY, &Float:fZ, &Float:fRotX, &Float:fRotY, &Float:fRotZ);
  • IsObjectMaterialSlotUsed(objectid, materialindex); // Return values: 1 = material, 2 = material text
  • GetObjectMaterial(objectid, materialindex, &modelid, txdname[], txdnamelen = sizeof(txdname), texturename[], texturenamelen = sizeof(texturename), &materialcoor);
  • GetObjectMaterialText(objectid, materialindex, text[], textlen = sizeof(text), &materialsize, fontface[], fontfacelen = sizeof(fontface), &fontsize, &bold, &fontcolor, &backcolor, &textalignment);

Objects get - player

  • GetPlayerObjectModel(playerid, objectid);
  • Float:GetPlayerObjectDrawDistance(playerid, objectid);
  • SetPlayerObjectMoveSpeed(playerid, objectid, Float:fSpeed);
  • Float:GetPlayerObjectMoveSpeed(playerid, objectid);
  • Float:GetPlayerObjectTarget(playerid, objectid, &Float:fX, &Float:fY, &Float:fZ);
  • GetPlayerObjectAttachedData(playerid, objectid, &attached_vehicleid, &attached_objectid);
  • GetPlayerObjectAttachedOffset(playerid, objectid, &Float:fX, &Float:fY, &Float:fZ, &Float:fRotX, &Float:fRotY, &Float:fRotZ);
  • IsPlayerObjectMaterialSlotUsed(playerid, objectid, materialindex); // Return values: 1 = material, 2 = material text
  • GetPlayerObjectMaterial(playerid, objectid, materialindex, &modelid, txdname[], txdnamelen = sizeof(txdname), texturename[], texturenamelen = sizeof(texturename), &materialcolor);
  • GetPlayerObjectMaterialText(playerid, objectid, materialindex, text[], textlen = sizeof(text), &materialsize, fontface[], fontfacelen = sizeof(fontface), &fontsize, &bold, &fontcolor, &backcolor, &textalignment);

special - for attached objects

  • GetPlayerAttachedObject(playerid, index, &modelid, &bone, &Float:fX, &Float:fY, &Float:fZ, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fSacleX, &Float:fScaleY, &Float:fScaleZ, &materialcolor1, &materialcolor2);
  • AttachPlayerObjectToObject(playerid, objectid, attachtoid, Float:OffsetX, Float:OffsetY, Float:OffsetZ, Float:RotX, Float:RotY, Float:RotZ, SyncRotation = 1);

RakNet ban functions

  • ClearBanList();
  • IsBanned(ipaddress[]);

Raknet

  • SetTimeoutTime(playerid, time_ms);
  • GetMTUSize();
  • GetLocalIP(index, localip[], len = sizeof(localip));

vehicle functions

  • GetVehicleSpawnPos(vehicleid, &Float:fX, &Float:fY, &Float:fZ);
  • GetVehicleColor(vehicleid, &color1, &color2);
  • GetVehiclePaintjob(vehicleid);
  • GetVehicleInterior(vehicleid);
  • GetVehicleNumberPlate(vehicleid, plate[], len = sizeof(plate));
  • SetVehicleRespawnDelay(vehicleid, delay);
  • GetVehicleRespawnDelay(vehicleid);
  • SetVehicleOccupiedTick(vehicleid, ticks);
  • GetVehicleOccupiedTick(vehicleid);
  • SetVehicleRespawnTick(vehicleid, ticks);
  • GetVehicleRespawnTick(vehicleid);
  • GetVehicleLastDriver(vehicleid);

Gangzones - Global

  • IsValidGangZone(zoneid);
  • IsPlayerInGangZone(playerid, zoneid);
  • IsGangZoneVisibleForPlayer(playerid, zoneid);
  • GangZoneGetColorForPlayer(playerid, zoneid);
  • GangZoneGetFlashColorForPlayer(playerid, zoneid);
  • IsGangZoneFlashingForPlayer(playerid, zoneid);
  • GangZoneGetPos(zoneid, &Float:fMinX, &Float:fMinY, &Float:fMaxX, &Float:fMaxY);

Gangzones - Player

  • CreatePlayerGangZone(playerid, Float:minx, Float:miny, Float:maxx, Float:maxy);
  • PlayerGangZoneDestroy(playerid, zoneid);
  • PlayerGangZoneShow(playerid, zoneid, color);
  • PlayerGangZoneHide(playerid, zoneid);
  • PlayerGangZoneFlash(playerid, zoneid, color);
  • PlayerGangZoneStopFlash(playerid, zoneid);
  • IsValidPlayerGangZone(playerid, zoneid);
  • IsPlayerInPlayerGangZone(playerid, zoneid);
  • IsPlayerGangZoneVisible(playerid, zoneid);
  • PlayerGangZoneGetColor(playerid, zoneid);
  • PlayerGangZoneGetFlashColor(playerid, zoneid);
  • IsPlayerGangZoneFlashing(playerid, zoneid);
  • PlayerGangZoneGetPos(playerid, zoneid);

Textdraw - Global

  • IsValidTextDraw(Text:textdrawid);
  • IsTextDrawVisibleForPlayer(playerid, Text:textdrawid);
  • TextDrawGetString(Text:textdrawid, text[], len = sizeof(text));
  • TextDrawSetPos(Text:textdrawid, Float:fX, Float:fY); // You can change textdraw pos with it, but you need to use TextDrawShowForPlayer() after that
  • TextDrawGetLetterSize(Text:textdrawid, &Float:fX, &Float:fY);
  • TextDrawGetFontSize(Text:textdrawid, &Float:fX, &Float:fY);
  • TextDrawGetPos(Text:textdrawid, &Float:fX, &Float:fY);
  • TextDrawGetColor(Text:textdrawid);
  • TextDrawGetBoxColor(Text:textdrawid);
  • TextDrawGetBackgroundColor(Text:textdrawid);
  • TextDrawGetShadow(Text:textdrawid);
  • TextDrawGetOutline(Text:textdrawid);
  • TextDrawGetFont(Text:textdrawid);
  • TextDrawIsBox(Text:textdrawid);
  • TextDrawIsProportional(Text:textdrawid);
  • TextDrawIsSelectable(textdrawid);
  • TextDrawGetAlignment(Text:textdrawid);
  • TextDrawGetPreviewModel(Text:textdrawid);
  • TextDrawGetPreviewRot(Text:textdrawid, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fZoom);
  • TextDrawGetPreviewVehCol(Text:textdrawid, &color1, &color2);

Textdraw - Player

  • IsValidPlayerTextDraw(playerid, PlayerText:textdrawid);
  • IsPlayerTextDrawVisible(playerid, PlayerText:textdrawid);
  • PlayerTextDrawGetString(playerid, PlayerText:textdrawid, text[], len = sizeof(text));
  • PlayerTextDrawSetPos(playerid, PlayerText:textdrawid, Float:fX, Float:fY);
  • PlayerTextDrawGetLetterSize(playerid, PlayerText:textdrawid, &Float:fX, &Float:fY);
  • PlayerTextDrawGetFontSize(playerid, PlayerText:textdrawid, &Float:fX, &Float:fY);
  • PlayerTextDrawGetPos(playerid, PlayerText:textdrawid, &Float:fX, &Float:fY);
  • PlayerTextDrawGetColor(playerid, PlayerText:textdrawid);
  • PlayerTextDrawGetBoxColor(playerid, PlayerText:textdrawid);
  • PlayerTextDrawGetBackgroundCol(playerid, PlayerText:textdrawid);
  • PlayerTextDrawGetShadow(playerid, PlayerText:textdrawid);
  • PlayerTextDrawGetOutline(playerid, PlayerText:textdrawid);
  • PlayerTextDrawGetFont(playerid, PlayerText:textdrawid);
  • PlayerTextDrawIsBox(playerid, PlayerText:textdrawid);
  • PlayerTextDrawIsProportional(playerid, PlayerText:textdrawid);
  • PlayerTextDrawIsSelectable(playerid, PlayerText:textdrawid);
  • PlayerTextDrawGetAlignment(playerid, PlayerText:textdrawid);
  • PlayerTextDrawGetPreviewModel(playerid, PlayerText:textdrawid);
  • PlayerTextDrawGetPreviewRot(playerid, PlayerText:textdrawid, &Float:fRotX, &Float:fRotY, &Float:fRotZ, &Float:fZoom);
  • PlayerTextDrawGetPreviewVehCol(playerid, PlayerText:textdrawid, &color1, &color2);

3D Text - Global

  • IsValid3DTextLabel(Text3D:id);
  • Get3DTextLabelText(Text3D:id, text[], len = sizeof(text));
  • Get3DTextLabelColor(Text3D:id);
  • Get3DTextLabelPos(Text3D:id, &Float:fX, &Float:fY, &Float:fZ);
  • Float:Get3DTextLabelDrawDistance(Text3D:id);
  • Get3DTextLabelLOS(Text3D:id);
  • Get3DTextLabelVirtualWorld(Text3D:id);
  • Get3DTextLabelAttachedData(Text3D:id, &attached_playerid, &attached_vehicleid);

3D Text - Player

  • IsValidPlayer3DTextLabel(playerid, PlayerText3D:id);
  • GetPlayer3DTextLabelText(playerid, PlayerText3D:id, text[], len = sizeof(text));
  • GetPlayer3DTextLabelColor(playerid, PlayerText3D:id);
  • GetPlayer3DTextLabelPos(playerid, PlayerText3D:id, &Float:fX, &Float:fY, &Float:fZ);
  • Float:GetPlayer3DTextLabelDrawDist(playerid, PlayerText3D:id);
  • GetPlayer3DTextLabelLOS(playerid, PlayerText3D:id);
  • GetPlayer3DTextLabelVirtualW(playerid, PlayerText3D:id);

Menu

  • IsMenuDisabled(Menu:menuid);
  • IsMenuRowDisabled(Menu:menuid, row);
  • GetMenuColumns(Menu:menuid);
  • GetMenuItems(Menu:menuid, column);
  • GetMenuPos(Menu:menuid, &Float:fX, &Float:fY);
  • GetMenuColumnWidth(Menu:menuid, column, &Float:fColumn1, &Float:fColumn2);
  • GetMenuColumnHeader(Menu:menuid, column, header[], len = sizeof(header));
  • GetMenuItem(Menu:menuid, column, itemid, item[], len = sizeof(item));

Pickups

  • IsValidPickup(pickupid);
  • GetPickupPos(pickupid, &Float:fX, &Float:fY, &Float:fZ);
  • GetPickupModel(pickupid);
  • GetPickupType(pickupid);
  • GetPickupVirtualWorld(pickupid);

Y_Less's model sizes inc

  • GetColCount();
  • Float:GetColSphereRadius(modelid);
  • GetColSphereOffset(modelid, &Float:fX, &Float:fY, &Float:fZ);