Skip to content

Commit

Permalink
fiddling with remote api
Browse files Browse the repository at this point in the history
  • Loading branch information
bwhitmire55 committed Oct 9, 2018
1 parent bf40b86 commit 9320f8b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
13 changes: 5 additions & 8 deletions event.inc
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,8 @@ hook OnPlayerCommandText(playerid, cmdtext[]) {

for(new i = 0; i < EVENT_MAX_CONCURRENT; i++) {
if(gEventData[i][eID] != 0) {

new buffer[30];
strcat(buffer, "/");
strcat(buffer, gEventData[i][eCommand]);

if(!strcmp(cmdtext, buffer, true)) {
if(!strcmp(cmdtext, gEventData[i][eCommand], true)) {
PutPlayerInEvent(playerid, i);
return 1;
}
Expand Down Expand Up @@ -231,9 +227,10 @@ public RemovePlayerFromEvent(playerid) {
return 0;
}

forward GetEventName(eventid);
public GetEventName(eventid) {
return gEventData[eventid][eName];
forward GetEventName(eventid, buffer[], size);
public GetEventName(eventid, buffer[], size) {
strcat(buffer, gEventData[eventid][eName], size);
return 1;
}

forward GetEventCommand(eventid);
Expand Down
4 changes: 3 additions & 1 deletion event_api.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public API_OnPlayerSpawnInEvent(playerid, id) {
}

stock GetName() {
return CallRemoteFunction("GetEventName", "i", gEventID);
new buffer[60];
CallRemoteFunction("GetEventName", "iai", gEventID, buffer, sizeof(buffer));
return buffer;
}

stock GetCommand() {
Expand Down
4 changes: 2 additions & 2 deletions filterscripts/minigun-dm/minigun-dm.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <a_samp>
#include <event_api>

const Float: gSpawnPoints[][4] =
static const Float: gSpawnPoints[][4] =
{
{ 2552.7036,2813.3635,27.8203,180.5949 },
{ 2610.1797,2820.7148,27.8203,173.7014 },
Expand Down Expand Up @@ -74,7 +74,7 @@ public OnPlayerDeath(playerid, killerid, reason) {
}

SetUpPlayer(playerid) {
new idx = random(sizeof(g_SpawnPoints));
new idx = random(sizeof(gSpawnPoints));
SetPlayerPos(playerid, gSpawnPoints[idx][0], gSpawnPoints[idx][1], gSpawnPoints[idx][2]);
SetPlayerFacingAngle(playerid, gSpawnPoints[idx][3]);
GivePlayerWeapon(playerid, 38, 5000);
Expand Down
3 changes: 2 additions & 1 deletion filterscripts/minigun-dm/pawn.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"entry": "minigun-dm.pwn",
"output": "../minigun-dm.amx",
"dependencies": [
"sampctl/samp-stdlib"
"sampctl/samp-stdlib",
"bwhitmire55/samp-event"
]
}
14 changes: 13 additions & 1 deletion test.pwn
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ main() {

public OnGameModeInit() {
print("Test mode for event.inc");
LoadEvent(1);
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[]) {
if(!strcmp(cmdtext, "/test1", true)) {
LoadEvent(1);
return 1;
}

if(!strcmp(cmdtext, "/test2", true)) {
LoadEvent(2);
return 1;
}
return 0;
}

0 comments on commit 9320f8b

Please sign in to comment.