Make script run properly
#1

How to make it run properly

new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, Owner! You are right person, welcome);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTBLUE, You are wrong person, GFO);


it for all players shows that they are owners of a vehicle
Reply
#2

You mean Removing if he's not the owner?
pawn Код:
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
{
   SendClientMessage(playerid, COLOR_LIGHTBLUE, Owner! You are right person, welcome);
   return 1;
}
else
{
   SendClientMessage(playerid, COLOR_LIGHTBLUE, You are wrong person, GFO);
   RemovePlayerFromVehicle(playerid);
}
Reply
#3

Код:
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
No he detect that all players have same name
Reply
#4

Quote:
Originally Posted by VoViNaToR
Посмотреть сообщение
Код:
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
No he detect that all players have same name
Most likely the problem is that VehicleInfo[veh][vOwner] is a blank string, which means it will automatically be true. You need to make sure VehicleInfo[veh][vOwner] is not empty, and filled with text.
Reply
#5

No it isnt empty
Код:
Owner=Tony_MacTavish
Reply
#6

You just took it out of the file, print the value of VehicleInfo[veh][vOwner]
Reply
#7

Ok i just made this to make sure that owners name is there
Код:
 format(string, sizeof(string), "--|Welcome back to your %s|-- Owners name is: %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
And it shows owners name corectly so i gues this
Код:
 if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 )
Isnt working
Reply
#8

Ok, I see the error.

pawn Код:
if(!strcmp(plname, VehicleInfo[veh][vOwner], true))
That should work.
Reply
#9

It actually checks if it returns 0, what the other one also did :P
Reply
#10

Ouuu daaam BIG Thanks it Works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)