Vehicle Respawning issues
#1

So, back again, this time, having issues with respawning cars...

Relevant code below:

Код:
CMD:rc(playerid, params[])
{
	new count = 0, respawncount = 0, pcount = 0;
	for(new i = 0; i < MAX_PLAYER_VEHICLES; i++) {
	    if(!strcmp(vInfo[i][vOwner], Name[playerid])) {
	        for(new u = 0; u < MAX_PLAYERS; u++) if(IsPlayerInVehicle(u, i)) pcount++;
	        if(pcount == 0) {
	            DestroyVehicle(vInfo[i][vCarID]);
	            vInfo[i][vCarID] = CreateVehicle(vInfo[i][vModel], vInfo[i][vLoc][0], vInfo[i][vLoc][1], vInfo[i][vLoc][2], vInfo[i][vLoc][3], vInfo[i][vCol1], vInfo[i][vCol2], -1);
				respawncount++;
			} count++;
		}
	}
	if(count == 0) return SCM(playerid, SCM_C_YELLOW, "You have no vehicles!");
	SCFM(playerid, SCM_C_YELLOW, "%d out of %d of your vehicles were respawned!", respawncount, pcount);
	return 1;
}
The issue, is with the /rc command, it's meant to only respawn the cars the player owns, which it DOES do.

The issue, is with the counting, I've made a doo doo somewhere, but I'm too tired to pick up on it, when I own one car, and aren't driving it, it should say '1 out of 1 of your vehicles were respawned'

And when I am driving it, it should say '0 out of 1 of your vehicles were respawned'

The issue is, it's saying 999 out of 0 of your vehicles were respawned, 999 rings alarm bells to me, in that there's two cars in the server, one owned by me, and the other, a test account, the max player cars is 1000, so that's where 999 comes from, but it's just not working right, and I kind of now need help fixing it...

Thanks, Zon.
Reply


Messages In This Thread
Vehicle Respawning issues - by Zonoya - 04.08.2015, 23:29
Re: Vehicle Respawning issues - by jamesbond007 - 04.08.2015, 23:48
Re: Vehicle Respawning issues - by Zonoya - 05.08.2015, 08:22

Forum Jump:


Users browsing this thread: 1 Guest(s)