Skip to content
View in the app

A better way to browse. Learn more.

GTAGames.nl - De Nederlandse Grand Theft Auto Community!

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[SA-MP|Script] Voorbeeld filterscript

Ik was weer eens aan het klooien in Pawno(X). En ik had een idee om een voertuig spawner te maken dat mensen een wagen konden spawnen via een commando. Maar dat was niet gelukt. Als iemand hier weet hoe te repareren... Tell me. Maar dit is nu meer bedoeld als voorbeeld filterscript.

#include <a_samp>

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA

public OnFilterScriptInit()
{
 print("\n----------------------------------");
 print("Vehicle spawner\n");
 print("	   v0.1\n");
 print("	By: Ywa*NL\n");
 print("----------------------------------\n");
}

public OnPlayerCommandText(playerid, cmdtext[])
{
 new string[256];
 new cmd[256];
 new idx;

 cmd = strtok(cmdtext, idx);

 if(strcmp(cmd, "/spawnhelp", true) == 0)
 {
   SendPlayerFormattedText(playerid,"VEHICLE SPAWNER - VERSION 0.1 - BY: YWA*NL",0);
	  SendPlayerFormattedText(playerid,"Type: /spawn [ID] - spawn a vehicle with defined ID",0);
return 1;
 }
 if(strcmp(cmd, "/spawn", true) == 0)
 {
new tmp[256];
new id;
new Float:PosX;
new Float:PosY;
new Float:PosZ;
	  tmp = strtok(cmdtext, idx);
	  if(!strlen(tmp))
{
		   SendClientMessage(playerid, COLOR_WHITE, "USAGE: /spawn [ID]");
	   	return 1;
	  }
		 id = strval(tmp);
	  if (id > 399 && id < 612)
{
  GetPlayerPos(playerid, PosX, PosY, PosZ);
//	  PosZ += 1.0;
		CreateVehicle(id, PosX, PosY, PosZ, 0.0, 0, 0, 1); // ???
		AddStaticVehicle(id, PosX, PosY, PosZ, 0.0, 0, 0); // ???
  //PutPlayerInVehicle(playerid, vehicleid, seatid);
		format(string, sizeof(string), "Spawned the defined vehicle (ID: %d).", id);
		SendClientMessage(playerid, COLOR_YELLOW, string);
		format(string, sizeof(string), "Debug %f | %f | %f", PosX, PosY, PosZ);
		SendClientMessage(playerid, COLOR_YELLOW, string);
	  }
	  else
	  {
		SendClientMessage(playerid, COLOR_WHITE, "Vehicle ID must be > 399 and < 612");
	  }
	  return 1;
 }
 return 0;
}

public OnPlayerConnect(playerid)
{
 SendPlayerFormattedText(playerid, "VEHICLE SPAWNER 0.1 ==> For help type /spawnhelp.", 0);
}

public SendPlayerFormattedText(playerid, const str[], define)
{
new tmpbuf[256];
format(tmpbuf, sizeof(tmpbuf), str, define);
SendClientMessage(playerid, 0xFFFF00AA, tmpbuf);
}

public SendAllFormattedText(playerid, const str[], define)
{
new tmpbuf[256];
format(tmpbuf, sizeof(tmpbuf), str, define);
SendClientMessageToAll(0xFFFF00AA, tmpbuf);
}

strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
	index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
	result[index - offset] = string[index];
	index++;
}
result[index - offset] = EOS;
return result;
}

Featured Replies

voertuigen spawnen met SA:MP kan simpelweg gewoon nog niet :)

Maar als ik de blogposts mag geloven zal je script bij de volgende versie wellicht werken:

Vehicles

I will also be overhauling the vehicle commands to allow dynamic creation, movement and destruction of vehicles through the script.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.