Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 916 online users. » 1 Member(s) | 911 Guest(s) Applebot, Bing, Google, DuckDuckGo, swuffted
|
Latest Threads |
Adding new vehicles and s...
Forum: Programming
Last Post: __.A.__
Yesterday, 07:47 PM
» Replies: 0
» Views: 46
|
Zona América del Sur Free...
Forum: Advertisements
Last Post: kevinberriosflores
Yesterday, 02:16 PM
» Replies: 1
» Views: 68
|
Busco copia de gamemode S...
Forum: Spanish/Espa?ol
Last Post: briancristaldo2021
2025-09-11, 11:14 AM
» Replies: 0
» Views: 56
|
[Tutorial] Registrando o ...
Forum: Portuguese/Portugu?s
Last Post: Crazy_ArKzX
2025-09-09, 08:36 PM
» Replies: 0
» Views: 198
|
San Andreas Police Pursui...
Forum: Advertisements
Last Post: BriBri
2025-09-08, 10:09 PM
» Replies: 1
» Views: 287
|
Problem with plugins load...
Forum: Support
Last Post: MrKacu13
2025-09-08, 07:15 PM
» Replies: 9
» Views: 335
|
Compilation error
Forum: Pawn Scripting
Last Post: MrKacu13
2025-09-07, 07:18 AM
» Replies: 6
» Views: 336
|
Need help, problem when i...
Forum: Programming
Last Post: nonickowned
2025-09-06, 06:21 PM
» Replies: 0
» Views: 142
|
Transfer server from SAMP...
Forum: Support
Last Post: MrKacu13
2025-09-06, 04:03 PM
» Replies: 1
» Views: 234
|
Not relevant anymore
Forum: Questions and Suggestions
Last Post: peti
2025-09-05, 02:00 PM
» Replies: 0
» Views: 192
|
|
|
[HELP] Spec on NPC |
Posted by: spyrothedragon96 - 2021-01-02, 04:43 PM - Forum: Pawn Scripting
- Replies (1)
|
 |
Hi everyone, I have a little problem with this script.
This script allows you to attack the camera on the npc via the command /camera, but once the camera is attached on the npc, I cannot change the view as you normally do on the player (usually with the V key).
Is it possible to do this?
Then another problem: when an NPC is in an interior, the interior is not visible.
This is the script.
Code: #include <a_samp>
#include <sscanf2>
#include <zcmd>
new IsSpectating[MAX_PLAYERS];
new Float:PosBeforeSpec[MAX_PLAYERS][3];
new InteriorBeforeSpec[MAX_PLAYERS];
new bool:LastTimeSpeced[MAX_PLAYERS];
ResetPlayerStats(playerid)
{
IsSpectating[playerid] = INVALID_PLAYER_ID;
PosBeforeSpec[playerid][0] = 0.0, PosBeforeSpec[playerid][1] = 0.0, PosBeforeSpec[playerid][2] = 0.0;
InteriorBeforeSpec[playerid] = 0;
LastTimeSpeced[playerid] = false;
}
public OnPlayerDisconnect(playerid, reason)
{
for(new i; i < MAX_PLAYERS; i)
{
if(IsSpectating[i] == playerid)
{
cmd_cameraoff(i, "");
}
}
ResetPlayerStats(playerid); //@@@WARNING: KEEP THIS LINE AT THE BOTTOM RIGHT HERE OR THINGS MAY BEHAVE DIFFERENT THAN EXPECTED!!!
return 1;
}
public OnPlayerSpawn(playerid)
{
if(LastTimeSpeced[playerid])
? ? {
? ? LastTimeSpeced[playerid] = false;
SetPlayerInterior(playerid, InteriorBeforeSpec[playerid]);
SetPlayerPos(playerid, PosBeforeSpec[playerid][0], PosBeforeSpec[playerid][1], PosBeforeSpec[playerid][2]);
? ? }
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_ONFOOT || newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
? ? {
? ? ? ? for(new i; i < MAX_PLAYERS; i)
? ? ? ? {
? ? ? ? ? ? if(IsSpectating[i] == playerid)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? SetPlayerToSpectatePlayer(i, playerid);
? ? ? ? ? ? }
? ? ? ? }
? ? }
? ? return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
if(newinteriorid != oldinteriorid)
{
for(new i; i < MAX_PLAYERS; i)
{
if(IsSpectating[i] == playerid && GetPlayerState(i) == PLAYER_STATE_SPECTATING)
{
SetPlayerToSpectatePlayer(i, playerid);
}
}
}
return 1;
}
CMD:camera(playerid, params[])
{
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usa: /camera <playerid/nome>");
if(!IsPlayerConnected(targetid) || !IsPlayerNPC(targetid)) return SendClientMessage(playerid, -1, "Player id invalido.");
if(playerid == targetid) return SendClientMessage(playerid, -1, "Non puoi guardare te stesso.");
//if(IsSpectating[targetid] != INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "That player is already watching someone.");
//if(GetPlayerState(targetid) == PLAYER_STATE_SPECTATING) return SendClientMessage(playerid, -1, "Player is in spectating mode. (Possibly didn't spawn yet)");
SetPlayerToSpectatePlayer(playerid, targetid);
if(IsSpectating[playerid] == INVALID_PLAYER_ID)
{
new str[156];
format(str, sizeof(str), "Ora stai guardando [%i]%s. Usa /cameraoff per smettere di guardarlo o /camera <id> per guardare un altro player.", targetid);
SendClientMessage(playerid, -1, str);
}
return 1;
}
CMD:cameraoff(playerid, params[])
{
if(IsSpectating[playerid] == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "Non stai guardando nessuno.");
LastTimeSpeced[playerid] = true;
StopPlayerSpectatePlayer(playerid);
return 1;
}
SetPlayerToSpectatePlayer(playerid, targetid)
{
IsSpectating[playerid] = targetid;
//Last pos before specing (if he was specing we don't get the next spec)
if(GetPlayerState(playerid) != PLAYER_STATE_SPECTATING)
{
GetPlayerPos(playerid, PosBeforeSpec[playerid][0], PosBeforeSpec[playerid][1], PosBeforeSpec[playerid][2]);
InteriorBeforeSpec[playerid] = GetPlayerInterior(playerid);
}
new targetInterior = GetPlayerInterior(targetid);
SetPlayerInterior(playerid, targetInterior);
TogglePlayerSpectating(playerid, 1);
if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER || GetPlayerState(targetid) == PLAYER_STATE_PASSENGER)
{
new vehToSpec = GetPlayerVehicleID(targetid);
PlayerSpectateVehicle(playerid, vehToSpec);
}
else PlayerSpectatePlayer(playerid, targetid);
return 1;
}
StopPlayerSpectatePlayer(playerid)
{
IsSpectating[playerid] = INVALID_PLAYER_ID;
TogglePlayerSpectating(playerid, 0);
SetPlayerInterior(playerid, InteriorBeforeSpec[playerid]);
SetPlayerPos(playerid, PosBeforeSpec[playerid][0], PosBeforeSpec[playerid][1], PosBeforeSpec[playerid][2]);
}
[color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]
[/font][/size][/color]
|
|
|
PlayerTextDrawSetString |
Posted by: Torque - 2021-01-02, 02:13 AM - Forum: Pawn Scripting
- Replies (2)
|
 |
I'm having an issue with this function. I have the below code:
Code: new zone[28];
GetPlayer3DZone(i, zone, MAX_ZONE_NAME);
PlayerTextDrawSetString(i, p_LocationTextdraw[i][1], zone);
The issue is that when it prints it onto the screen, every word is on a new line. I know that a string is meant to be something like "This_is_one_line" but since the 3D Zone string that's produced has spaces instead of underscores, it's difficult to get it to work correct.
Any tips?
Code: stock GetPlayer3DZone(playerid, zone[], len) //Credits to Cueball, Betamaster, Mabako, and Simon (for finetuning).
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i != sizeof(gSAZones); i )
{
if(x >= gSAZones[i][SAZONE_AREA][0] && x <= gSAZones[i][SAZONE_AREA][3] && y >= gSAZones[i][SAZONE_AREA][1] && y <= gSAZones[i][SAZONE_AREA][4] && z >= gSAZones[i][SAZONE_AREA][2] && z <= gSAZones[i][SAZONE_AREA][5])
{
? ? return format(zone, len, gSAZones[i][SAZONE_NAME], 0);
}
}
return 0;
}
|
|
|
Customization for skins (peds and CJ) |
Posted by: vico - 2021-01-02, 02:12 AM - Forum: Questions and Suggestions
- Replies (1)
|
 |
- Be able to set per-skin walking styles (mostly for those who wants to keep the walking style for default peds but fix the peds with rollers);
- Change CJ (skin ID 0) clothing and stats like fatness and buffness, like MTA does (the function can return a different value if it can't change the clothing/body value due to the player have other ped as a skin).
- Be able to add CJs with different body stats and clothing in AddPlayerClass.
|
|
|
YSI/y_ini |
Posted by: tootsao - 2021-01-01, 05:48 PM - Forum: Pawn Scripting
- Replies (2)
|
 |
Hello, i have ini login/register?system with y_ini and i want to ask how do i make lime house or vehicle?system that uses?y_ini to save and load?
|
|
|
Best way to load data from db using sscanf |
Posted by: shane adevaratu - 2021-01-01, 01:48 PM - Forum: Pawn Scripting
- Replies (1)
|
 |
I'm trying to improve the efficiency of the script when logging in and I have a question.
Is there a better method compared to the example below,?to load the data from the database?
Code: cache_get_value_name( 0, "Table", result_70 ); format( str_70, sizeof str_70, result_70 );
sscanf( str_70, "p<|>iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii",
playerVariable[ playerid ][ pTable ][ 0 ], playerVariable[ playerid ][ pTable ][ 1 ], playerVariable[ playerid ][ pTable ][ 2 ],
playerVariable[ playerid ][ pTable ][ 3 ], playerVariable[ playerid ][ pTable ][ 4 ], playerVariable[ playerid ][ pTable ][ 5 ],
playerVariable[ playerid ][ pTable ][ 6 ], playerVariable[ playerid ][ pTable ][ 7 ], playerVariable[ playerid ][ pTable ][ 8 ],
playerVariable[ playerid ][ pTable ][ 9 ], playerVariable[ playerid ][ pTable ][ 10 ], playerVariable[ playerid ][ pTable ][ 11 ],
playerVariable[ playerid ][ pTable ][ 12 ], playerVariable[ playerid ][ pTable ][ 13 ], playerVariable[ playerid ][ pTable ][ 14 ],
playerVariable[ playerid ][ pTable ][ 15 ], playerVariable[ playerid ][ pTable ][ 16 ], playerVariable[ playerid ][ pTable ][ 17 ],
playerVariable[ playerid ][ pTable ][ 18 ], playerVariable[ playerid ][ pTable ][ 19 ], playerVariable[ playerid ][ pTable ][ 20 ],
playerVariable[ playerid ][ pTable ][ 21 ], playerVariable[ playerid ][ pTable ][ 22 ], playerVariable[ playerid ][ pTable ][ 23 ],
playerVariable[ playerid ][ pTable ][ 24 ], playerVariable[ playerid ][ pTable ][ 25 ], playerVariable[ playerid ][ pTable ][ 26 ],
playerVariable[ playerid ][ pTable ][ 27 ], playerVariable[ playerid ][ pTable ][ 28 ], playerVariable[ playerid ][ pTable ][ 29 ],
playerVariable[ playerid ][ pTable ][ 30 ], playerVariable[ playerid ][ pTable ][ 31 ], playerVariable[ playerid ][ pTable ][ 32 ],
playerVariable[ playerid ][ pTable ][ 33 ], playerVariable[ playerid ][ pTable ][ 34 ], playerVariable[ playerid ][ pTable ][ 35 ],
playerVariable[ playerid ][ pTable ][ 36 ], playerVariable[ playerid ][ pTable ][ 37 ], playerVariable[ playerid ][ pTable ][ 38 ],
playerVariable[ playerid ][ pTable ][ 39 ], playerVariable[ playerid ][ pTable ][ 40 ], playerVariable[ playerid ][ pTable ][ 41 ],
playerVariable[ playerid ][ pTable ][ 42 ], playerVariable[ playerid ][ pTable ][ 43 ], playerVariable[ playerid ][ pTable ][ 44 ],
playerVariable[ playerid ][ pTable ][ 45 ], playerVariable[ playerid ][ pTable ][ 46 ], playerVariable[ playerid ][ pTable ][ 47 ],
playerVariable[ playerid ][ pTable ][ 48 ], playerVariable[ playerid ][ pTable ][ 49 ] );
In database: Varchar, Lenght 70, As defined 0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
|
|
|
In-Game Map Editor |
Posted by: Torque - 2020-12-29, 10:28 PM - Forum: Pawn Scripting
- Replies (1)
|
 |
Hey guys, I'm looking for a map editor plugin/filterscript to use in-game, with the ability to remove stock objects and generate a script.
Much regards, Such thanks.
|
|
|
|