12.02.2010, 23:03
I am looking to make a strcmp teleport code and im stuck on 1 bit.
the actual bit that teleports
heres the code
this line here i created myself assuming it would work:
if(iValue == i) {
but it doesnt.
This is the crucial line that makes it teleport but it doesnt, i ran an else on that bit and no matter what i put in, thats what it came out with.
can someone help?
the actual bit that teleports
heres the code
Code:
if(strcmp(cmd, "/floor", true, 6) == 0) { if(GetPlayerVirtualWorld(playerid) == 1) { for(new i=0; i<sizeof(CarParkFloor); i++) { if(IsPlayerInRangeOfPoint(playerid, 2.0, CarParkFloor[i][0], CarParkFloor[i][1], CarParkFloor[i][2])) { new tmp[32]; tmp = strtok(cmdtext, idx); if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /floor [1-10]"); new iValue = strval(tmp); if(iValue == i) { SetPlayerPos(playerid, CarParkFloor[i][0]-2, CarParkFloor[i][1], CarParkFloor[i][2]); SetPlayerVirtualWorld(playerid, 0); TogglePlayerControllable(playerid, 1); } } } } else return SendClientMessage(playerid, 0xFF0000FF, "You cannot use this command at this time."); }
if(iValue == i) {
but it doesnt.
This is the crucial line that makes it teleport but it doesnt, i ran an else on that bit and no matter what i put in, thats what it came out with.
can someone help?