(Help) Cars always spawn there.
#1

Hey there.
1 problem: I have an admin command to spawn cars. But when I spawn them they are permanent parked there, if they blow up or whatever. Anyway to change so that when I spawn cars in /v they will dissapear if the blow up?

Second problem: When I get a gun from someone and relogg, i get the dubble amount. How to fix that?

Thanks alot.
Reply
#2

https://sampwiki.blast.hk/wiki/CreateVehicle
Set the last parameter to -1. As for your other problem you will more than likely need to show your code could be multiple reasons thats happening.
Reply
#3

Код:
dcmd_giveweapon(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 2) {
	    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
	    if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /giveweapon [playerid] [weapon id/weapon name] [ammo]");
		new player1 = strval(tmp), weap, ammo, WeapName[32], string[128];
		if(!strlen(tmp3) || !IsNumeric(tmp3) || strval(tmp3) <= 0 || strval(tmp3) > 99999) ammo = 500; else ammo = strval(tmp3);
		if(!IsNumeric(tmp2)) weap = GetWeaponIDFromName(tmp2); else weap = strval(tmp2);
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
        	if(!IsValidWeapon(weap)) return SendClientMessage(playerid,COLOR_RED,"ERROR: Invalid weapon ID");

			GetWeaponName(weap,WeapName,32);
			new str[128];
            format(str, sizeof(str), "%s has given a %s with %d rounds of ammo to %s.",pName(playerid), weap, ammo,pName(player1));
            SaveLog("Weapon Log", str);
			format(string, sizeof(string), "You have given %s a %s (%d) with %d rounds of ammo", pName(player1), WeapName,  ammo); SendClientMessage(playerid,COLOR_YELLOW,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has given you a %s (%d) with %d rounds of ammo", pName(playerid), WeapName,  ammo); SendClientMessage(player1,COLOR_YELLOW,string); }
   			return GivePlayerWeapon(player1, weap, ammo);
	    } else return SendClientMessage(playerid,COLOR_RED,"ERROR: Player is not connected");
	} else return SendClientMessage(playerid,COLOR_RED,"You are not an admin.");
}
Reply
#4

Wow, now i know not to hire/ask for something to be made from....ps...you ^^^^^^
Reply
#5

I agree with steven here that code is very poorly written. And the indentation makes your code very hard to read. You need to look into using sscanf not only is it faster than strtok, but it makes your code alot tidier too. When people post code with indentation that is that bad i won't even look through it... If you haven't bothered why should i?

Tip: Use [pawn][/ pawn] tags.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)