strmid not working (+rep)
#1

Hi All.I just maked ownership with selling car to player and right now i have problem with strmid...I have function strmid

pawn Код:
strmid(MyVehicle[vehicleid][MyVehOwner], GetName(playerid), 0, strlen(GetName(playerid)), 255);
but when i sell car to player and he accept this vehicle isn't for player which buyed car but its on car seller ... The Vehicle Owner is not changing ... Why ??
Reply
#2

help ?
Reply
#3

pawn Код:
strmid(MyVehicle[vehicleid][MyVehOwner], GetName(playerid), 0, strlen(GetName(id)), 255);
in strlen(getname(playerid)) you have to set it to strlen(getname(theotherplayername))
Reply
#4

Well, when you want to change string, why are you using strmid? I'd suggest you to use strcpy function. (fastest method for copying strings)

pawn Код:
//To the top of your script
#define strcpy(%0,%1) strcat((%0[0] = '\0', %0), %1)
//Usage: strcpy(dest[], source[], sizeof (dest));

//Then in your code
strcpy(MyVehicle[vehicleid][MyVehOwner], NameOfPlayerToSellCar, sizeof (MyVehicle[]));
NameOfPlayerToSellCar change it for variable of player name that are you going to sell car to.
Reply
#5

nevermind i fixed ... the problem was in car. .. i put GetPlayerVehicleID(playerid); and now working thanks repped for all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)