Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 378 online users. » 0 Member(s) | 375 Guest(s) Yandex, Google, Bing
|
|
|
How can I do an ini save for this tuning system using AttachObjectToVehicle? |
Posted by: Paco_Martez - 2021-07-01, 08:25 PM - Forum: Pawn Scripting
- No Replies
|
|
Hi, I don't know how to speak English very well, I'm from Argentina but ..., How can I save an .ini for this tuning system using AttachObjectToVehicle?
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <streamer>
#include <mSelection>
#include <YSI\y_ini>
#define DRAWDISTANCE_DEFAULT 80
#define SPEEDMULTIPLIER_HIGH? ? ? ? 0.20
#define SPEEDMULTIPLIER_LOW? ? ? ? 0.01
#define MODE_NONE? ? ? ? ? 0
#define MODE_PX 1
#define MODE_PY? ? 2
#define MODE_PZ? ? ? ? ? ? 3
#define MODE_RX? ? ? ? ? ? 4
#define MODE_RY? ? ? ? ? ? 5
#define MODE_RZ? ? ? ? ? ? 6
#define MAX_OBJVEH? ? ? ? ? 7
//Defines
#define PlayerToPoint(%1,%2,%3,%4,%5)? IsPlayerInRangeOfPoint(%2,%1,%3,%4,%5)
#define? ? ? ? ? ? Message ? ? ? ? ? ? ? ? ? ? ? ? ? ? SendClientMessage
#define SendFormattedMessage(%0,%1,%2) do{new _str[128]; format(_str,128,%2); SendClientMessageEx(%0,%1,_str);}while(FALSE)
#define GivePlayerCash GivePlayerMoney
//Colores
#define Blanco 5883
#define iCOL_RED? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 0xFF0000FF
//Dialogo
//Textdraws
// News
//Catalogo
new objetostu = mS_INVALID_LISTID;
//Taller
#define TG_FILE "Talleres/%d.ini"
#define TG_OBJ? ? ? ? "Objetos/%d.ini"
#define MAX_TUNE? ? ? 5000
#define MAX_GARAGES? 5000
//Dialogos
#define DIALOG_TUNING_TALLER 8431 //Ids para evitar bugs :s
//Enums
enum Attaching
{
Temp,
bool:Saved,
Timer,
bool:Enabled,
Mode,
ModelID,
ObjectID,
VehicleID,
Float:P[3],
Float:R[3],
d_ObjIdInput
};
new Attach[MAX_PLAYERS][Attaching];
enum aaa {
Float:Position[ 3 ],
? ? Text3D:tg3D,
? ? tgPickup,
}
new Talleres[ MAX_GARAGES ][ aaa ];
//Stocks
public OnFilterScriptInit()
{
objetostu = LoadModelSelectionMenu("objetostu.txt");
? for(new i = 1; i < MAX_GARAGES; i) {
? ? new file[ 50 ];
? ? format( file, sizeof( file ), TG_FILE, i );
? ? if( fexist( file ) ) {
? ? INI_ParseFile( file, "LoadTalleres", .bExtra = true, .extra = i );
? ? ? ? Talleres[ i ][ tg3D ] = Create3DTextLabel( "Usa {b9f442}/tuning {FFFFFF}para tunear tu veh?culo", -1, Talleres[ i ][ Position ][ 0 ], Talleres[ i ][ Position ][ 1 ], Talleres[ i ][ Position ][ 2 ], 15.0, 0, 1 );
Talleres[ i ][ tgPickup ] = CreatePickup( 1239, 1, Talleres[ i ][ Position ][ 0 ], Talleres[ i ][ Position ][ 1 ], Talleres[ i ][ Position ][ 2 ], -1 );
}
}
return 1; //se retorna a 1.
}
public OnFilterScriptExit()
{
for(new i=0; i<MAX_PLAYERS; i) { KillTimer(Attach[i][Timer]); }
print("\n? :C\n");
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
? ? Attach[playerid][Saved] = true;
return true;
}
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
if(listid == objetostu)
{
if(response)
{
? ? ? ? ? Atta(playerid, modelid);
GivePlayerMoney(playerid, -5000); //dinero
SendClientMessage(playerid, 0xFFFFFFFF, "Compraste un objeto para tu veh?culo.");
}
else SendClientMessage(playerid, 0xFFFFFFFF, "Has salido del catalogo de objetos.");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(Attach[playerid][Timer]);
Attach[playerid][Mode] = MODE_NONE;
? ? Attach[playerid][Temp] = 0;
? ? Attach[playerid][ModelID] = 0;
? ? Attach[playerid][ObjectID] = 0;
? ? Attach[playerid][VehicleID] = 0;
? ? Attach[playerid][Enabled] = false;
? ? for(new i=0; i<3; i) { Attach[playerid][P][i] = 0.0; Attach[playerid][R][i] = 0.0;}
return true;
}
CMD:creditostuning(playerid, params[])
{
SendClientMessage(playerid, -1, "Sistema Creador Por Franco Londes, Franco12 en pawnscript.");
return 1;
}
CMD:creartaller( playerid, params[] ) {
? ? if( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid,-1,? "Debes estar logeado con rcon." );
? ? new i = NextIDGarage( MAX_GARAGES ), Float:Pos[ 3 ], file[ 40 ];
GetPlayerPos( playerid, Pos[ 0 ], Pos[ 1 ], Pos[ 2 ] );
format( file, sizeof( file ), TG_FILE, i );
if( fexist( file ) ) return SendClientMessage( playerid,-1, "Esta ID ya existe." );
Talleres[ i ][ Position ][ 0 ] = Pos[ 0 ];
Talleres[ i ][ Position ][ 1 ] = Pos[ 1 ];
Talleres[ i ][ Position ][ 2 ] = Pos[ 2 ];
Talleres[ i ][ tg3D ] = Create3DTextLabel( "Usa {b9f442}/tuning {FFFFFF}para tunear tu veh?culo", -1, Talleres[ i ][ Position ][ 0 ], Talleres[ i ][ Position ][ 1 ], Talleres[ i ][ Position ][ 2 ], 15.0, 0, 1 );
Talleres[ i ][ tgPickup ] = CreatePickup( 1239, 1, Talleres[ i ][ Position ][ 0 ], Talleres[ i ][ Position ][ 1 ], Talleres[ i ][ Position ][ 2 ], -1 );
SaveTalleres( i );
return true;
}
//==============================================================================
CMD:eliminartaller( playerid, params[] ) {
? ? if( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, -1, "Debes estar logeado con rcon." );
new i = GetNearestTalleres( playerid );
if( i == -1 ) return SendClientMessage( playerid, -1,? "No est?s en el taller (pickup)." );
Talleres[ i ][ Position ][ 0 ] = 0.0;
Talleres[ i ][ Position ][ 1 ] = 0.0;
Talleres[ i ][ Position ][ 2 ] = 0.0;
DestroyPickup( Talleres[ i ][ tgPickup ] );
Delete3DTextLabel( Talleres[ i ][ tg3D ] );
? ? new file[ 50 ];
format( file, sizeof( file ), TG_FILE, i );
if( fexist( file ) ) { fremove( file ); }
SendClientMessage( playerid, -1, "Taller eliminado." );
return true;
}
CMD:tuning(playerid, params[])
{
if( GetNearestTalleres( playerid ) == -1 ) return SendClientMessage( playerid, -1, "No est?s en el taller de tuning." );
if( !IsPlayerInAnyVehicle(playerid) ) return SendClientMessage(playerid, 0xFF0000FF, "No est?s en un veh?culo.");
ShowPlayerDialog(playerid, DIALOG_TUNING_TALLER, DIALOG_STYLE_LIST, "Menu Tuning", "Comprar Objeto\nEditar Posici?n de Objeto\nRemover Objeto", "Seleccionar", "Cancelar");
return 1;
}
CMD:4532434343(playerid, params[])
{
? ? if( !Attach[playerid][Saved] ) {
? ? ShowModelSelectionMenu(playerid, objetostu, "Venta de Objetos");
return true;
}
new modelid;
Atta(playerid, modelid);
return true;
}
?
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// Si se pulsa el primer bot?n.
{
switch(dialogid)// Si s?lo tiene un cuadro de di?logo, entonces esto no es necesario, pero es m?s Organizado para cuando se implementan m?s cuadros de di?logo.
{
case DIALOG_TUNING_TALLER:// Nuestro dialogo
? ? ? ? {
? ? ? ? ? switch(listitem)// Comprueba Si a Sido Seleccionado
? ? ? ? {
? ? ? ? ? ? case 0:// El Primer Boton Incluido
? ? ? ? ? ? {
? ? ? ? ? ? ? ? ? ? ShowModelSelectionMenu(playerid, objetostu, "Venta de Objetos");
? ? ? ? ? ? }
? ? ? ? ? ? case 1: // Esto es el segundo boton
? ? ? ? ? ? {
SendClientMessage(playerid, -1, "Usa /ayudatuning para editar la posici?n del objeto, /terminartuning para acabar");
? ? ? ? ? ? }
? ? ? ? ? ? case 2: // El Tercer boton
? ? ? ? ? ? {
SendClientMessage(playerid, -1, "Has eliminado el objeto");
DestroyObject(Attach[playerid][ObjectID]);
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? }
}
? ? }
return 1;
}
//=========================================================================================================================================================
//=====================================================================================================================================================
GetNearestTalleres( playerid ) {
? ? for(new i = 1; i < MAX_GARAGES; i) {
? ? ? ? if( IsPlayerInRangeOfPoint( playerid, 10.0, Talleres[ i ][ Position ][ 0 ], Talleres[ i ][? Position ][ 1 ], Talleres[ i ][ Position ][ 2 ] ) ) { return i; }
}
return -1;
}
//========================================================================================================================================================
stock NextIDGarage(const len) {
? ? new id = (-1);
? ? for( new loop = ( 0 ), provjera = ( -1 ), Data_[ 64 ] = "\0"; loop != len; loop ) {
? ? ? provjera = ( loop );
? ? ? format( Data_, ( sizeof Data_ ), TG_FILE, provjera );
? ? ? if(!fexist(Data_)) {
? ? ? ? ? id = ( provjera );
? ? ? ? ? break; } }
? return ( id );
}
//==============================================================================
forward SaveTalleres( id );
public SaveTalleres( id ) {
new iFile[ 40 ];
? ? format( iFile, sizeof( iFile ), TG_FILE, id );
new INI:File = INI_Open( iFile );
INI_WriteFloat( File, "Position1", Talleres[ id ][ Position ][ 0 ] );
INI_WriteFloat( File, "Position2", Talleres[ id ][ Position ][ 1 ] );
INI_WriteFloat( File, "Position3", Talleres[ id ][ Position ][ 2 ] );
INI_Close( File );
return 1;
}
//==============================================================================
forward LoadTalleres( id, name[], value[] );
public LoadTalleres( id, name[], value[] ) {
INI_Float( "Position1", Talleres[ id ][ Position ][ 0 ] );
INI_Float( "Position2", Talleres[ id ][ Position ][ 1 ] );
INI_Float( "Position3", Talleres[ id ][ Position ][ 2 ] );
? ? return true;
}
//==============================================================================
forward Atta(playerid, modelid);
//==============================================================
public Atta(playerid, modelid)
{
? ? Attach[playerid][Timer] = SetTimerEx("OnPlayerUpdateEx", 50, true, "d", playerid);
? ?
? ? //==================================================================================
? ? Attach[playerid][Mode] = MODE_NONE;
? ? Attach[playerid][Temp] = 0;
? ? Attach[playerid][VehicleID] = 0;
? ? for(new i=0; i<3; i) { Attach[playerid][P][i] = 0.0; Attach[playerid][R][i] = 0.0;}
? ?
? ? //======================================================================================
? ? Attach[playerid][Enabled] = true;
Attach[playerid][ModelID] = modelid;
Attach[playerid][ObjectID] = CreateObject(Attach[playerid][ModelID], 0, 0, -1000, 0, 0, 0, DRAWDISTANCE_DEFAULT);
Attach[playerid][VehicleID] = GetPlayerVehicleID(playerid);
AttachObjectToVehicle(Attach[playerid][ObjectID], Attach[playerid][VehicleID], 0, 0, 0, 0, 0, 0);
? ? EditDynamicObject(playerid, ObjectID);
Attach[playerid][Saved] = false;
return true;
}
CMD:ayudatuning(playerid, params[])
{
SendClientMessage(playerid, -1, "Usa /posx, /posy, /posz, para cambiar la posici?n del objeto.");
SendClientMessage(playerid, -1, "Usa /rotx, /roty, /rotz, para cambiar la rotaci?n del objeto. /terminartuning para terminar.");
return 1;
}
CMD:posx(playerid, params[])
{
? ? if(!Attach[playerid][Enabled]) { SendClientMessage(playerid, 0xFF0000FF, "?No est?s en el taller de tuning!."); }
? ? else { Attach[playerid][Mode] = MODE_PX; SendClientMessage(playerid, -1, "[X]Bien, usa las teclas Izquierda/Derecha para editar, /terminartuning para acabar."); }
return true;
}
CMD:posy(playerid, params[])
{
? ? if(!Attach[playerid][Enabled]) { SendClientMessage(playerid, 0xFF0000FF, "?No est?s en el taller de tuning!."); }
? ? else { Attach[playerid][Mode] = MODE_PY; SendClientMessage(playerid, -1, "[Y]Bien, usa las teclas Izquierda/Derecha para editar, /terminartuning para acabar."); }
return true;
}
CMD:posz(playerid, params[])
{
? ? if(!Attach[playerid][Enabled]) { SendClientMessage(playerid, 0xFF0000FF, "?No est?s en el taller de tuning!."); }
? ? else { Attach[playerid][Mode] = MODE_PZ; SendClientMessage(playerid, -1, "[Z]Bien, usa las teclas Izquierda/Derecha para editar, /terminartuning para acabar."); }
return true;
}
CMD:rotx(playerid, params[])
{
? ? if(!Attach[playerid][Enabled]) { SendClientMessage(playerid, 0xFF0000FF, "?No est?s en el taller de tuning!."); }
? ? else { Attach[playerid][Mode] = MODE_RX; SendClientMessage(playerid, -1, "[RX]Bien, usa las teclas Izquierda/Derecha para editar, /terminartuning para acabar."); }
return true;
}
CMD:roty(playerid, params[])
{
? ? if(!Attach[playerid][Enabled]) { SendClientMessage(playerid, 0xFF0000FF, "?No est?s en el taller de tuning!."); }
? ? else { Attach[playerid][Mode] = MODE_RY; SendClientMessage(playerid, -1, "[RY]Bien, usa las teclas Izquierda/Derecha para editar, /terminartuning para acabar."); }
return true;
}
CMD:rotz(playerid, params[])
{
? ? if(!Attach[playerid][Enabled]) { SendClientMessage(playerid, 0xFF0000FF, "?No est?s en el taller de tuning!."); }
? ? else { Attach[playerid][Mode] = MODE_RZ; SendClientMessage(playerid, -1, "[RZ]Bien, usa las teclas Izquierda/Derecha para editar, /terminartuning para acabar."); }
return true;
}
CMD:terminartuning(playerid, params[])
{
? ? if(!Attach[playerid][Enabled]) { SendClientMessage(playerid, 0xFF0000FF, "?No est?s en el taller de tuning!."); }
? ? else { Attach[playerid][Mode] = MODE_NONE; SendClientMessage(playerid, 0xFF00FFFF, "Tuning Finalizado."); KillTimer(Attach[playerid][Timer]); }
? ? return true;
}
forward OnPlayerUpdateEx(playerid);
public OnPlayerUpdateEx(playerid)
{
if(Attach[playerid][Mode] == MODE_NONE) return true;
? ? new KEYS, UD, LR; GetPlayerKeys( playerid, KEYS, UD, LR );
new Float:SPDM = 0.1;
if(KEYS == 128) { SPDM = SPEEDMULTIPLIER_HIGH; }
else if (KEYS == 4) { SPDM = SPEEDMULTIPLIER_LOW; }
? ? if(LR > 0) { UpdateVObject(playerid, SPDM); }
else if(LR < 0) { UpdateVObject(playerid, -SPDM); }
? ? return 1;
}
forward UpdateVObject(playerid, Float:value);
public UpdateVObject(playerid, Float:value)
{
DestroyObject(Attach[playerid][ObjectID]);
Attach[playerid][ObjectID] = CreateObject(Attach[playerid][ModelID], 0, 0, 6, 0, 0, 0, DRAWDISTANCE_DEFAULT);
switch(Attach[playerid][Mode])
{
? ? case MODE_PX: {
? ? ? ? Attach[playerid][P][0] = value;
? ? ? ? new string[64];
? ? ? ? format(string, sizeof(string), "Editando Posicion [X]",Attach[playerid][P][0]);
? ? ? ? GameTextForPlayer(playerid, string, 10000, 3);
}
case MODE_PY: {
? ? Attach[playerid][P][1] = value;
? ? ? ? new string[64];
? ? ? ? format(string, sizeof(string), "Editando Posicion [Y]",Attach[playerid][P][1]);
? ? ? ? GameTextForPlayer(playerid, string, 10000, 3);
}
case MODE_PZ: {
? ? Attach[playerid][P][2] = value;
? ? ? ? new string[64];
? ? ? ? format(string, sizeof(string), "Editando Posicion [Z]",Attach[playerid][P][1]);
? ? ? ? GameTextForPlayer(playerid, string, 10000, 3);
}
case MODE_RX: {
? ? ? ? if(Attach[playerid][R][0] value*10 <= 360.0 && Attach[playerid][R][0] value*10 >= 0.0) { Attach[playerid][R][0] = value*10; }
? ? ? ? new string[64];
? ? ? ? format(string, sizeof(string), "Editando Rotacion [X]",Attach[playerid][P][0]);
? ? ? ? GameTextForPlayer(playerid, string, 10000, 3);
}
case MODE_RY: {
? ? if(Attach[playerid][R][1] value*10 <= 360.0 && Attach[playerid][R][1] value*10 >= 0.0) { Attach[playerid][R][1] = value*10; }
? ? ? ? new string[64];
? ? ? ? format(string, sizeof(string), "Editando Rotacion [Y]",Attach[playerid][R][1]);
? ? ? ? GameTextForPlayer(playerid, string, 10000, 3);
}
case MODE_RZ: {
? ? if(Attach[playerid][R][2] value*10 <= 360.0 && Attach[playerid][R][2] value*10 >= 0.0) { Attach[playerid][R][2] = value*10; }
? ? ? ? new string[64];
? ? ? ? format(string, sizeof(string), "Editando Rotacion [Z]",Attach[playerid][R][2]);
? ? ? ? GameTextForPlayer(playerid, string, 10000, 3);
}
}
AttachObjectToVehicle(Attach[playerid][ObjectID], Attach[playerid][VehicleID], Attach[playerid][P][0], Attach[playerid][P][1], Attach[playerid][P][2], Attach[playerid][R][0], Attach[playerid][R][1], Attach[playerid][R][2]);
return true;
}
|
|
|
help with mysql plugin error |
Posted by: Lyonkrs - 2021-07-01, 08:45 AM - Forum: Pawn Scripting
- Replies (2)
|
|
The error log
Code: cache_delete:?invalid?cache?id?'0'
This is my Pawn Code:
Code: CMD:actorlist(playerid, params[])
{
new list[1024], skin, Float:AcX, Float:AcY, Float:AcZ, id, Descriptions[48];
new query[1024];
new Cache: actorlist;
mysql_format(SQLHandle, query, sizeof(query), "SELECT * FROM `actor`");
mysql_query(SQLHandle, query);
new rows = cache_num_rows();
if(rows)
{
format(list, sizeof(list), "ID\tSkin\tDescriptions\tDistance\n");
for(new i; i < rows; )
{
cache_get_value_name_int(i, "ID", id);
cache_get_value_name_int(i, "SkinID", skin);
cache_get_value_name_float(i,"X", AcX);
cache_get_value_name_float(i,"Y", AcY);
cache_get_value_name_float(i,"Z", AcZ);
cache_get_value_name(i,"Descriptions", Descriptions);
new Float: distance = GetPlayerDistanceFromPoint(playerid, AcX, AcY, AcZ);
format(list, sizeof(list), "%s%d\t%d\t%s\t%.2f\n", list, id, skin, Descriptions, distance);
}
ShowPlayerDialog(playerid, DIALOG_ACTOR_LIST, DIALOG_STYLE_TABLIST_HEADERS, "Actor List Manager", list, "Manage", "Close");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "ERROR: There's no Actor list on server");
return 1;
}
cache_delete(actorlist);
return 1;
}
The system is works perfectly but why it's giving error?
|
|
|
Help with tables |
Posted by: Pedxz - 2021-07-01, 01:19 AM - Forum: Pawn Scripting
- No Replies
|
|
Well, I downloaded a GM and it didn't come with the SQL import file, so it can be uploaded to phpmyadmin! I would like to know if you can help me with some tables, some I created myself, but others, I'm having difficulties, because they are created, but they don't save anything!?
Sample code from a table that is occurring what I said:
Code: stock CarregarFileMySQL(playerid)
[/font][/size][/color]
{
new TmpInt;
format(gStr, sizeof(gStr), "SELECT * FROM `"TABLE_CONTAS"` WHERE `Nick` = BINARY '%s'", pNome(playerid));
mysql_query(IDConexao, gStr);
if(cache_num_rows() == 0)
{
format(gstring, sizeof(gstring), "INSERT INTO `"TABLE_CONTAS"` (`Nick`, `?ltimoLogin`, `Data Registro`, `IP`) VALUES ('%s', '%d', '%d', '%s')", pNome(playerid), gettime(), gettime(), GetPlayerIP(playerid));
mysql_query(IDConexao, gstring, false);
format(gStr, sizeof(gStr), "SELECT * FROM `"TABLE_CONTAS"` WHERE `Nick` = BINARY '%s'", pNome(playerid));
mysql_query(IDConexao, gStr);
}
cache_get_value_name(0, "CorBarraStatus", pInfo[playerid][BarraCor]);
cache_get_value_name_int(0, "ID", pInfo[playerid][PlayerID]);
cache_get_value_name_int(0, "Cargo", aInfo[playerid][Cargo]);
cache_get_value_name_int(0, "Espi?o", aInfo[playerid][Espiao]);
cache_get_value_name_int(0, "?ltimoLogin", pInfo[playerid][UltimoLogin]);
cache_get_value_name_int(0, "TipoVIP", pInfo[playerid][TipoVIP]);
cache_get_value_name_int(0, "TempoVIP", pInfo[playerid][TempoVIP]);
cache_get_value_name_int(0, "Fome", pInfo[playerid][Fome]);
cache_get_value_name_int(0, "Sede", pInfo[playerid][Sede]);
cache_get_value_name_int(0, "SegundosUP", pInfo[playerid][SegundosUP]);
cache_get_value_name_int(0, "Exp", pInfo[playerid][Exp]);
cache_get_value_name_int(0, "Saldo", pInfo[playerid][Saldo]);
// ----- //
cache_get_value_name_int(0, "RUP_Possui", pInfo[playerid][RUP_Possui]);
cache_get_value_name_int(0, "RUP_Ligado", pInfo[playerid][RUP_Ligado]);
cache_get_value_name(0, "RUP_Cor", pInfo[playerid][RUP_Cor]);
cache_get_value_name_int(0, "LCL_Possui", pInfo[playerid][LCL_Possui]);
cache_get_value_name_int(0, "VFC_Possui", pInfo[playerid][VFC_Possui]);
cache_get_value_name_int(0, "SGR_Possui", pInfo[playerid][SGR_Possui]);
cache_get_value_name_int(0, "CPT_Possui", pInfo[playerid][CPT_Possui]);
cache_get_value_name_int(0, "CPT_Modelo", pInfo[playerid][CPT_Modelo]);
cache_get_value_name_int(0, "CVN_Possui", pInfo[playerid][CVN_Possui]);
cache_get_value_name_int(0, "CTB_Possui", pInfo[playerid][CTB_Possui]);
cache_get_value_name_int(0, "CEL_Possui", pInfo[playerid][CEL_Possui]);
cache_get_value_name_int(0, "CEL_SMS", pInfo[playerid][CEL_SMS]);
cache_get_value_name_int(0, "YTP_Possui", pInfo[playerid][YTP_Possui]);
cache_get_value_name_int(0, "GPSC_Possui", pInfo[playerid][GPSC_Possui]);
cache_get_value_name_int(0, "GPSC_Status", pInfo[playerid][GPSC_Status]);
cache_get_value_name_int(0, "GPSL_Possui", pInfo[playerid][GPSL_Possui]);
cache_get_value_name_int(0, "GPSL_Status", pInfo[playerid][GPSL_Status]);
cache_get_value_name_int(0, "KIT_Possui", pInfo[playerid][KIT_Possui]);
cache_get_value_name_int(0, "KITF_Possui", pInfo[playerid][KITF_Possui]);
// ----- //
cache_get_value_name_int(0, "Moedas", TmpInt);
GivePlayerMoedas(playerid, TmpInt);
cache_get_value_name_int(0, "pLevel", TmpInt);
SetPlayerScore(playerid, TmpInt);
cache_get_value_name_int(0, "Dinheiro", TmpInt);
GivePlayerCash(playerid, TmpInt);
cache_get_value_name_int(0, "Procurado", TmpInt);
SetPlayerWantedLevel(playerid, TmpInt);
// --------------------- //
if(GetPlayerCargo(playerid) >= C_MODERADOR) aInfo[playerid][BloqueadoR] = true;
if(pInfo[playerid][TipoVIP] != -1 || GetPlayerCargo(playerid) >= C_MODERADOR) ChatVIP[playerid] = true;
SetPVarInt(playerid, "pID", pInfo[playerid][PlayerID]);
SetPVarInt(playerid, "pCargo", aInfo[playerid][Cargo]);
// ------------------------------------------ //
format(gstring, sizeof(gstring), "UPDATE `"TABLE_CONTAS"` SET `?ltimoLogin` = %d, `IP` = '%s' WHERE `ID` = %d", gettime(), GetPlayerIP(playerid), pInfo[playerid][PlayerID]);
mysql_query(IDConexao, gstring, false);
// ------------------------------------------ //
// blogins
format(gStr, sizeof(gStr), "INSERT INTO `"TABLE_LOGINS"` (`Jogador_ID`, `TS_Logou`) VALUES (%d, %d)", pInfo[playerid][PlayerID], gettime());
mysql_query(IDConexao, gStr);
pInfo[playerid][SessaoID] = cache_insert_id();
pInfo[playerid][TimeLogou] = gettime();
pInfo[playerid][LevelLogou] = pInfo[playerid][Level];
// ------------------------------------------ //
pInfo[playerid][Logado] = true;
// ------------------------------------------ //
format(gstring, sizeof(gstring), "[ %s - %s ] %s logou no servidor. [ IP: %s | Level: %d | Saldo: %d | Grana: %d | Moedas: %d | Frag: %d / %d ]",
Gdata(), Ghora(), pNome(playerid), GetPlayerIP(playerid), pInfo[playerid][Level], pInfo[playerid][Saldo], GetPlayerCash(playerid), GetPlayerMoedas(playerid), pInfo[playerid][fMatou], pInfo[playerid][fMorreu]);
LogLogins(gstring);
[color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]}
|
|
|
(5) warning 213: tag mismatch |
Posted by: SAMPZA - 2021-06-30, 12:17 PM - Forum: Pawn Scripting
- Replies (1)
|
|
Hello guys, i need your help
i want to make an code easier so i create this code bellow but i got 5 warnings 213 ( problem here?PlayerInfo[playerid][AchInfo2[i][AchVar]] )
do you have any ideas about this
Code: #define?MAX_ACHS 2
new verylargestr[4096];
enum ach_info
{
AchID,
AchName[64],
AchScore,
AchNeeded,
AchVar
};
new AchInfo2[MAX_ACHS][ach_info] = { // Here Achievements info
{1,"Killer 1 : Kill 100 players", 10.000, 70, 15}, // 15 meaning the classement of the array of players look at?enum playerinfo
{2,"Killer 2?: kill 500 players", 30.000, 500, 15}
};
CMD:achievements(playerid, params[])
{
new gstr[128];
? ? format(verylargestr, sizeof verylargestr, "");
? ? strcat(verylargestr, ""yellow_e"Buy Gold vip 1 time and get your reward "white"100.000 Scores\n");
? ? strcat(verylargestr, ""yellow_e"Buy Silver vip 1 time and get your reward "white"70.000 Scores\n");
? ? strcat(verylargestr, ""yellow_e"Buy Bronze vip 1 time and get your reward Bronze "white"30.000 Scores\n");
for(new i = 0; i < sizeof(AchInfo2); i)
{
? ? if(PlayerInfo[playerid][AchInfo2[i][AchVar]] >= AchInfo2[i][AchNeeded])
{
format(gstr, sizeof gstr, "\n{2DFF00}%d.) %d/%d %s - %d Scores",i, AchInfo2[i][AchNeeded],AchInfo2[i][AchNeeded],AchInfo2[i][AchName],AchInfo2[i][AchScore]);
strcat(verylargestr, gstr);
}
? ? else if(PlayerInfo[playerid][AchInfo2[i][AchVar]] < AchInfo2[i][AchNeeded])
{
format(gstr, sizeof gstr, "\n{F64B4B}%d.) %d/%d %d - %d Scores", i, PlayerInfo[playerid][AchInfo2[i][AchVar]], AchInfo2[i][AchNeeded],AchInfo2[i][AchName],AchInfo2[i][AchScore]);
strcat(verylargestr, gstr);
}
}
? ? ShowPlayerDialog(playerid, DIALOG_ACHS, DIALOG_STYLE_MSGBOX, "Achievements List", verylargestr, "Ok", "");
? ? return true;
}
enum playerinfo
{
? ? pID, //0
pUsername[26], //1
pPassword[128], //2
.
.
.
pKills // 15
};
new PlayerInfo[MAX_PLAYERS][playerinfo];
|
|
|
ActorGalore - Actor Editor |
Posted by: UnuAlex - 2021-06-28, 11:19 AM - Forum: Filterscripts
- Replies (2)
|
|
Hi! This is my first post on this forum. So...Hi there! Nice to meet u!
I decided to realease this script here too, so that more poeple can have access to it and use it.
This script as the titles suggests its an actor editor i created. Its really usefull to quickly edit actors directly in-game.
If you want to learn how to use it check the video downbellow \/. Or if you don't have the patience just type /actorhelp, that will display all the commands available to you. Ofcourse first make sure you're rcon logged.
Video Presentation:?https://youtu.be/F4ikjwt2wT0?t=67
Download:?https://github.com/UnuAlex/Actor-Galore
|
|
|
Help with enter and exiting an interior |
Posted by: XDK6 - 2021-06-28, 03:05 AM - Forum: Pawn Scripting
- No Replies
|
|
Hello Burgershot Community,
I have a problem with my 3dtext label and exiting a property on my script. Whenever I exit the property it tp me to the first 24/7 store that I created instead of the new one.
here is the code I use on creating a property system with printing the ids on 3d text label
variables and enums:
Code: #define MAX_STORES 500
enum sInfo
{
sID,
sType,
Text3D:sLabel,
sName[50],
sMapIcon,
sPickup,
Float:sX,
Float:sY,
Float:sZ,
sInt,
sVirt,
Float:intsX,
Float:intsY,
Float:intsZ,
sintInt,
sintVirt,
bool:sIDUsed
};
new storeinfo[MAX_STORES][sInfo];
new TotalStores;
Code for creating the store
Code: createstore(storeid, type, Float:X, Float:Y, Float:Z, Float:IntX, Float:IntY, Float:IntZ, intInt, intVirt)
{
TotalStores;
storeinfo[storeid][sID] = storeid;
storeinfo[storeid][sX] = X;
storeinfo[storeid][sY] = Y;
storeinfo[storeid][sZ] = Z;
storeinfo[storeid][sInt] = 0;
storeinfo[storeid][sVirt] = 0;
storeinfo[storeid][intsX] = IntX;
storeinfo[storeid][intsY] = IntY;
storeinfo[storeid][intsZ] = IntZ;
storeinfo[storeid][sintInt] = intInt;
storeinfo[storeid][sintVirt] = intVirt;
intVirt = storeinfo[storeid][sID];
storeinfo[storeid][sIDUsed] = true;
storeinfo[storeid][sPickup] = CreateDynamicPickup(1272, 1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 0);
storeinfo[storeid][sType] = type;
new string2[128];
if(storeinfo[storeid][sType] == 1)
{
format(string2, sizeof(string2), "24/7 (ID:%d)", storeinfo[storeid][sName], storeinfo[storeid][sID]);
? ? ? ? storeinfo[storeid][sLabel] = Create3DTextLabel(string2, -1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 30.0, storeinfo[storeid][sVirt]);
for(new i = 0; i < MAX_PLAYERS; i)
? ? {
storeinfo[storeid][sMapIcon] = CreateDynamicMapIcon(storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 17, 1, 0, 0, i, 300, MAPICON_LOCAL);
}
}
if(storeinfo[storeid][sType] == 2)
{
format(string2, sizeof(string2), "Burgershot (ID:%d)", storeinfo[storeid][sName], storeinfo[storeid][sID]);
? ? ? ? storeinfo[storeid][sLabel] = Create3DTextLabel(string2, -1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 30.0, storeinfo[storeid][sVirt]);
for(new i = 0; i < MAX_PLAYERS; i)
? ? {
storeinfo[storeid][sMapIcon] = CreateDynamicMapIcon(storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 10, 1, 0, 0, i, 300, MAPICON_LOCAL);
}
}
if(storeinfo[storeid][sType] == 3)
{
format(string2, sizeof(string2), "Cluckin Bell (ID:%d)", storeinfo[storeid][sName], storeinfo[storeid][sID]);
? ? ? ? storeinfo[storeid][sLabel] = Create3DTextLabel(string2, -1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 30.0, storeinfo[storeid][sVirt]);
for(new i = 0; i < MAX_PLAYERS; i)
? ? {
storeinfo[storeid][sMapIcon] = CreateDynamicMapIcon(storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 14, 1, 0, 0, i, 300, MAPICON_LOCAL);
}
}
if(storeinfo[storeid][sType] == 4)
{
format(string2, sizeof(string2), "Well Stacked Pizza Co. (ID:%d)", storeinfo[storeid][sName], storeinfo[storeid][sID]);
? ? ? ? storeinfo[storeid][sLabel] = Create3DTextLabel(string2, -1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 30.0, storeinfo[storeid][sVirt]);
for(new i = 0; i < MAX_PLAYERS; i)
? ? {
storeinfo[storeid][sMapIcon] = CreateDynamicMapIcon(storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 29, 1, 0, 0, i, 300, MAPICON_LOCAL);
}
}
if(storeinfo[storeid][sType] == 5)
{
format(string2, sizeof(string2), "Binco (ID:%d)", storeinfo[storeid][sName], storeinfo[storeid][sID]);
? ? ? ? storeinfo[storeid][sLabel] = Create3DTextLabel(string2, -1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 30.0, storeinfo[storeid][sVirt]);
for(new i = 0; i < MAX_PLAYERS; i)
? ? {
storeinfo[storeid][sMapIcon] = CreateDynamicMapIcon(storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 45, 1, 0, 0, i, 300, MAPICON_LOCAL);
}
}
if(storeinfo[storeid][sType] == 6)
{
format(string2, sizeof(string2), "Zip (ID:%d)", storeinfo[storeid][sName], storeinfo[storeid][sID]);
? ? ? ? storeinfo[storeid][sLabel] = Create3DTextLabel(string2, -1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 30.0, storeinfo[storeid][sVirt]);
for(new i = 0; i < MAX_PLAYERS; i)
? ? {
storeinfo[storeid][sMapIcon] = CreateDynamicMapIcon(storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 45, 1, 0, 0, i, 300, MAPICON_LOCAL);
}
}
if(storeinfo[storeid][sType] == 7)
{
format(string2, sizeof(string2), "Pro-Laps (ID:%d)", storeinfo[storeid][sName], storeinfo[storeid][sID]);
storeinfo[storeid][sLabel] = Create3DTextLabel(string2, -1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 30.0, storeinfo[storeid][sVirt]);
for(new i = 0; i < MAX_PLAYERS; i)
? ? {
storeinfo[storeid][sMapIcon] = CreateDynamicMapIcon(storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 45, 1, 0, 0, i, 300, MAPICON_LOCAL);
}
}
if(storeinfo[storeid][sType] == 8)
{
format(string2, sizeof(string2), "Suburban (ID:%d)", storeinfo[storeid][sName], storeinfo[storeid][sID]);
storeinfo[storeid][sLabel] = Create3DTextLabel(string2, -1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 30.0, storeinfo[storeid][sVirt]);
for(new i = 0; i < MAX_PLAYERS; i)
? ? {
storeinfo[storeid][sMapIcon] = CreateDynamicMapIcon(storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 45, 1, 0, 0, i, 300, MAPICON_LOCAL);
}
}
if(storeinfo[storeid][sType] == 9)
{
format(string2, sizeof(string2), "Didier Sachs (ID:%d)", storeinfo[storeid][sName], storeinfo[storeid][sID]);
? ? ? ? storeinfo[storeid][sLabel] = Create3DTextLabel(string2, -1, storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 30.0, storeinfo[storeid][sVirt]);
for(new i = 0; i < MAX_PLAYERS; i)
? ? {
storeinfo[storeid][sMapIcon] = CreateDynamicMapIcon(storeinfo[storeid][sX], storeinfo[storeid][sY], storeinfo[storeid][sZ], 45, 1, 0, 0, i, 300, MAPICON_LOCAL);
}
}
new string[128];
format(string, sizeof(string), "Store ID: %d has been created. Total Stores: %d", storeid, TotalStores);
printf(string);
}
Enter and Exit code:
Code: stock SendPlayerInsideStore(playerid, storeid)
{
if(storeid == MAX_STORES) return 0;
new Float:X = storeinfo[storeid][intsX], Float:Y = storeinfo[storeid][intsY], Float:Z = storeinfo[storeid][intsZ], Int = storeinfo[storeid][sintInt], Virt = storeinfo[storeid][sID];
SetPlayerPos(playerid, X, Y, Z);
SetPlayerInterior(playerid, Int);
SetPlayerVirtualWorld(playerid, Virt);
return 1;
}
stock SendPlayerOutsideStore(playerid, storeid)
{
if(storeid != MAX_STORES)
{
? ? ? ? new Float:X = storeinfo[storeid][sX], Float:Y = storeinfo[storeid][sY], Float:Z = storeinfo[storeid][sZ], Int = storeinfo[storeid][sInt];
SetPlayerPos(playerid, X, Y, Z);
SetPlayerInterior(playerid, Int);
SetPlayerVirtualWorld(playerid, 0);
}
else return 0;
return 1;
}
|
|
|
How to make pasword validation? |
Posted by: CrypticSin - 2021-06-27, 02:48 PM - Forum: Pawn Scripting
- Replies (2)
|
|
Hello i need help with?password validation, so if registered user types wrong password more than 3 times to login, it should kick the user?
PHP Code: public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
? ? if(dialogid == REGISTER_DIALOG)
? ? {
? ? ? ? if(response)
? ? ? ? {
? ? ? ? ? ? if(strlen(inputtext) < 3 || strlen(inputtext) > 24)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? SendClientMessage(playerid, -1, "SERVER: Your password must be from 3-24 characters.");
? ? ? ? ? ? ? ? return ShowPlayerDialog(playerid, REGISTER_DIALOG, DIALOG_STYLE_PASSWORD, "{FFFFFF}Register Account", "{FFFFFF}Please enter a password below to register an account:", "Enter", "Leave");
? ? ? ? ? ? }
? ? ? ?
? ? ? ? ? ? bcrypt_hash(playerid, "OnPlayerRegister", inputtext, 12);
? ? ? ? ? ? return 1;
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? Kick(playerid);
? ? ? ? }
? ? }
? ? else if(dialogid == LOGIN_DIALOG)
? ? {
? ? ? ? if(response)
? ? ? ? {
? ? ? ? ? ? new query[256], field[64];
? ? ? ? ? ? format(query, sizeof(query), "SELECT `PASS` FROM `USERS` WHERE `NAME` = '%s' COLLATE NOCASE", DB_Escape(ReturnName(playerid)));
? ? ? ? ? ? database_result = db_query(server_database, query);
? ? ? ? ? ? ? if(db_num_rows(database_result))
? ? ? ? ? ? {
? ? ? ? ? ? ? ? db_get_field_assoc(database_result, "PASS", field, sizeof(field));
? ? ? ? ? ? ? ? ? bcrypt_verify(playerid, "OnPlayerLogin", inputtext, field);
? ? ? ? ? ? }
? ? ? ? ? ? return 1;
? ? ? ? }
? ? ? ? else
? ? ? ? {
? ? ? ? ? ? Kick(playerid);
? ? ? ? }
? ? }
? ? return 1;
}
|
|
|
|