strcmp
#1

Hi,

I want to create a command who check the car spawn and a name.

My code:

Код:
GetPlayerName(giveplayerid, gpname, MAX_PLAYER_NAME);
for(new i = 0; i < MAX_VEHICLES; iv++)
{
        printf("veh %d",i);
        if(strcmp(gpname, VehicleInfo[i][Owner], true) == 0)   // gpname is the name , VehicleInfo[i][Owner] is the owner
	{
	  	printf("check %s,%s",gpnme,VehicleInfo[i][Owner]);
                print("VEHiCLE SPAWN");
		return 1 ;
	}
}
So I'm John_Turn I spawn a car id= 1, in my log:
"veh 1"
"check John_Turn,John_Turn"
"VEHiCLE SPAWN"

Perfect but if I dont spawn a vehicle I have in my log:
"veh 1"
"check John_Turn, " nothing
"VEHiCLE SPAWN"


So if VehicleInfo[i][Owner] = my name or nothing, it say my car is spawn. This problиme is if(strcmp(gpname, VehicleInfo[i][Owner], true) == 0) Ihve tested !=1 ... but identical.

Help thanks.
Reply
#2

check if all the variables are working well, i had similar problems which when i debugged it, it showed that the variables wasn't assigned correctly.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)