07.01.2019, 17:48
(
Последний раз редактировалось lWiDuAlKl; 08.01.2019 в 21:10.
)
Hi I follow few tutorials and I make my script in visual studio.
I have:
https://github.com/Zeex/sampgdk/releases/tag/v4.6.2
https://github.com/Zeex/samp-plugin-sdk
separate folder: sdk
the project folder contains: sampgdk.h ,sampgdh.c source.def, source.cpp etc..
Settings:
Property Pages > C/C++ > General > Additional Include Directory : SDK folder and Project folder
Property Pages > C/C++ > General > Preprocesor WIN32 and SAMPGDK_CPP_WRAPPERS
Property Pages > Linker > Input > Source.def
I have NEW FILTER > Existent item SDK Library
ADD> Existent item> sampgdk.h and sampgdh.c
when I put my plugins I have:
HostName: SA-MP 0.3 Server
Address: localhost:7777
Players: 0 / 50
Ping: 2
Mode: Hello, World!
Language: English
C++ code:
I'm spawned in LV work /hello and CamPos, but
I have the following warnings:
and I build with CTRL+F7
How can I solve?
I don't have sampgdk.lib
I tried with old version 4.5.3, I don't have errors but my plugin is not loaded.
new.pwn:
I have:
https://github.com/Zeex/sampgdk/releases/tag/v4.6.2
https://github.com/Zeex/samp-plugin-sdk
separate folder: sdk
the project folder contains: sampgdk.h ,sampgdh.c source.def, source.cpp etc..
Settings:
Property Pages > C/C++ > General > Additional Include Directory : SDK folder and Project folder
Property Pages > C/C++ > General > Preprocesor WIN32 and SAMPGDK_CPP_WRAPPERS
Property Pages > Linker > Input > Source.def
I have NEW FILTER > Existent item SDK Library
ADD> Existent item> sampgdk.h and sampgdh.c
when I put my plugins I have:
HostName: SA-MP 0.3 Server
Address: localhost:7777
Players: 0 / 50
Ping: 2
Mode: Hello, World!
Language: English
C++ code:
Код:
#include <amx\amx.h> #include <plugincommon.h> #include <stdio.h> #include <string.h> #include <sampgdk.h> void SAMPGDK_CALL PrintTickCountTimer(int timerid, void *params) { sampgdk::logprintf("Tick count: %d", sampgdk::GetTickCount()); } PLUGIN_EXPORT bool PLUGIN_CALL OnGameModeInit() { sampgdk::SetGameModeText("Hello, World!"); sampgdk::AddPlayerClass(0, 1958.3783f, 1343.1572f, 15.3746f, 269.1425f,0, 0, 0, 0, 0, 0); sampgdk::SetTimer(1000, true, PrintTickCountTimer, 0); return true; } PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerConnect(int playerid) { sampgdk::SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to the HelloWorld server!"); return true; } PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerRequestClass(int playerid,int classid) { sampgdk::SetPlayerPos(playerid, 1958.3783f, 1343.1572f, 15.3746f); sampgdk::SetPlayerCameraPos(playerid, 1958.3783f, 1343.1572f, 15.3746f); sampgdk::SetPlayerCameraLookAt(playerid, 1958.3783f, 1343.1572f, 15.3746f, CAMERA_CUT); return true; } PLUGIN_EXPORT bool PLUGIN_CALL OnPlayerCommandText(int playerid,const char *cmdtext) { if (strcmp(cmdtext, "/hello") == 0) { char name[MAX_PLAYER_NAME]; sampgdk::GetPlayerName(playerid, name, sizeof(name)); char message[MAX_CLIENT_MESSAGE]; //sprintf(message, "Hello, %s!", name); sampgdk::SendClientMessage(playerid, 0x00FF00FF, message); return true; } return false; } PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() { return sampgdk::Supports(); } PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) { return sampgdk::Load(ppData); } PLUGIN_EXPORT void PLUGIN_CALL Unload() { return sampgdk::Unload(); } PLUGIN_EXPORT void PLUGIN_CALL ProcessTick() { return sampgdk::ProcessTick(); }
I have the following warnings:
Код:
1>------ Rebuild All started: Project: SA-MP C++, Configuration: Debug Win32 ------ 1>amxplugin.cpp 1>Source.cpp 1>d:\windows kits\10\include\10.0.17763.0\ucrt\malloc.h(174): warning C4005: 'alloca': macro redefinition 1>g:\proiect\sdk\amx\amx.h(87): note: see previous definition of 'alloca' 1>Generating Code... 1>getch.c 1>sampgdk.c 1>Generating Code... 1> Creating library G:\Proiect\SA-MP C++\Debug\SA-MP C++.lib and object G:\Proiect\SA-MP C++\Debug\SA-MP C++.exp 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_Supports imported in function "unsigned int __cdecl sampgdk::Supports(void)" (?Supports@sampgdk@@YAIXZ) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_Load imported in function "bool __cdecl sampgdk::Load(void * *)" (?Load@sampgdk@@YA_NPAPAX@Z) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_Unload imported in function "void __cdecl sampgdk::Unload(void)" (?Unload@sampgdk@@YAXXZ) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_ProcessTick imported in function "void __cdecl sampgdk::ProcessTick(void)" (?ProcessTick@sampgdk@@YAXXZ) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_vlogprintf imported in function "void __cdecl sampgdk::logprintf(char const *,...)" (?logprintf@sampgdk@@YAXPBDZZ) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_SendClientMessage imported in function "bool __cdecl sampgdk::SendClientMessage(int,int,char const *)" (?SendClientMessage@sampgdk@@YA_NHHPBD@Z) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_GetTickCount imported in function "int __cdecl sampgdk::GetTickCount(void)" (?GetTickCount@sampgdk@@YAHXZ) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_SetGameModeText imported in function "bool __cdecl sampgdk::SetGameModeText(char const *)" (?SetGameModeText@sampgdk@@YA_NPBD@Z) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_AddPlayerClass imported in function "int __cdecl sampgdk::AddPlayerClass(int,float,float,float,float,int,int,int,int,int,int)" (?AddPlayerClass@sampgdk@@YAHHMMMMHHHHHH@Z) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_SetTimer imported in function "int __cdecl sampgdk::SetTimer(int,bool,void (__cdecl*)(int,void *),void *)" (?SetTimer@sampgdk@@YAHH_NP6AXHPAX@Z1@Z) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_SetPlayerPos imported in function "bool __cdecl sampgdk::SetPlayerPos(int,float,float,float)" (?SetPlayerPos@sampgdk@@YA_NHMMM@Z) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_GetPlayerName imported in function "int __cdecl sampgdk::GetPlayerName(int,char *,int)" (?GetPlayerName@sampgdk@@YAHHPADH@Z) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_SetPlayerCameraPos imported in function "bool __cdecl sampgdk::SetPlayerCameraPos(int,float,float,float)" (?SetPlayerCameraPos@sampgdk@@YA_NHMMM@Z) 1>Source.obj : warning LNK4217: locally defined symbol _sampgdk_SetPlayerCameraLookAt imported in function "bool __cdecl sampgdk::SetPlayerCameraLookAt(int,float,float,float,int)" (?SetPlayerCameraLookAt@sampgdk@@YA_NHMMMH@Z) 1>SA-MP C++.vcxproj -> G:\Proiect\SA-MP C++\Debug\SA-MP C++.dll 1>Done building project "SA-MP C++.vcxproj". ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Код:
1>------ Build started: Project: SA-MP C++, Configuration: Debug Win32 ------ 1>Source.cpp 1>d:\windows kits\10\include\10.0.17763.0\ucrt\malloc.h(174): warning C4005: 'alloca': macro redefinition 1>g:\proiect\sdk\amx\amx.h(87): note: see previous definition of 'alloca' 1>Done building project "SA-MP C++.vcxproj". ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
I don't have sampgdk.lib
I tried with old version 4.5.3, I don't have errors but my plugin is not loaded.
new.pwn:
Код:
#include <a_samp> main() { } public OnGameModeInit() { return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { return 1; } public OnPlayerConnect(playerid) { return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) { return 1; } public OnPlayerDeath(playerid, killerid, reason) { return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { return 1; } public OnPlayerEnterCheckpoint(playerid) { return 1; } public OnPlayerLeaveCheckpoint(playerid) { return 1; } public OnPlayerEnterRaceCheckpoint(playerid) { return 1; } public OnPlayerLeaveRaceCheckpoint(playerid) { return 1; } public OnRconCommand(cmd[]) { return 1; } public OnPlayerRequestSpawn(playerid) { return 1; } public OnObjectMoved(objectid) { return 1; } public OnPlayerObjectMoved(playerid, objectid) { return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { return 1; } public OnVehicleMod(playerid, vehicleid, componentid) { return 1; } public OnVehiclePaintjob(playerid, vehicleid, paintjobid) { return 1; } public OnVehicleRespray(playerid, vehicleid, color1, color2) { return 1; } public OnPlayerSelectedMenuRow(playerid, row) { return 1; } public OnPlayerExitedMenu(playerid) { return 1; } public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { return 1; } public OnRconLoginAttempt(ip[], password[], success) { return 1; } public OnPlayerUpdate(playerid) { return 1; } public OnPlayerStreamIn(playerid, forplayerid) { return 1; } public OnPlayerStreamOut(playerid, forplayerid) { return 1; } public OnVehicleStreamIn(vehicleid, forplayerid) { return 1; } public OnVehicleStreamOut(vehicleid, forplayerid) { return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; }