Alexander. Posted June 18, 2015 Report Share Posted June 18, 2015 (edited) Comanda urmatoare se executa aiurea. In loc de id user ia direct interiorul, ca si cum n=ar mai fi nevoie de id player-ului. Spuneti-mi va rog ce este gresit si de ce, ca nu imi dau seama nici cum.if(strcmp(cmd, "/setvw", true) == 0) { if(IsPlayerConnected(playerid)) { if(gLogged[playerid] == 1) { if (PlayerInfo[playerid][pAdmin] >= 1) { new in; temp = strtok(cmdtext, idx); if(!strlen(temp)) { SendClientMessage(playerid, COLOR_SYN, "Synthax: /setvw <playerid/PartOfName> <vw>"); return 1; } targetid = ReturnUser(temp); temp = strtok(cmdtext, idx); in = strval(temp); if(IsPlayerConnected(targetid)) { if(targetid != INVALID_PLAYER_ID) { GetPlayerName(playerid, pName, sizeof(pName)); GetPlayerName(targetid, pNameGive, sizeof(pNameGive)); SetPlayerVirtualWorld(targetid, in); format(string, sizeof(string), "Adminul %s i-a setat lui %s virtualworld %d.", pName,pNameGive,in); SCMAdmins(string); format(string, sizeof(string), "Adminul %s ti-a setat virtualworld %d.", pName,in); SendClientMessage(playerid, COLOR_LIGHTRED2, string); return 1; } } } } } return 1; } Edited June 18, 2015 by Alexander. Caut un om serios cu gamemode acceptabil, cu capabilitatea de a tine un host, serviciile oferite de mine sunt de scripter (experienta de 5 ani in C/C++ limbajul folosit de SA:MP). Nu am pretentii la bani, doar un server si un parteneriat frumos. Pentru mai multe detalii accept pm-uri. Universitatea de Vest din Timisoara, Facultatea de Matematica si Informatica Informatica aplicata, Anul I Link to comment Share on other sites More sharing options...
Rappy Posted June 19, 2015 Report Share Posted June 19, 2015 Incearca asta. if(strcmp(cmd, "/setvw", true) == 0) { if(IsPlayerConnected(playerid)) { if(gLogged[playerid] == 1) { if (PlayerInfo[playerid][pAdmin] >= 1) { new in; temp = strtok(cmdtext, idx); targetid = ReturnUser(temp); in = strval(temp); if(!strlen(temp)) { SendClientMessage(playerid, COLOR_SYN, "Synthax: /setvw <playerid/PartOfName> <vw>"); return 1; } if(IsPlayerConnected(targetid)) { if(targetid != INVALID_PLAYER_ID) { GetPlayerName(playerid, pName, sizeof(pName)); GetPlayerName(targetid, pNameGive, sizeof(pNameGive)); SetPlayerVirtualWorld(targetid, in); format(string, sizeof(string), "Adminul %s i-a setat lui %s virtualworld %d.", pName,pNameGive,in); SCMAdmins(string); format(string, sizeof(string), "Adminul %s ti-a setat virtualworld %d.", pName,in); SendClientMessage(playerid, COLOR_LIGHTRED2, string); return 1; } } } } } return 1; } Link to comment Share on other sites More sharing options...
Alexander. Posted June 19, 2015 Author Report Share Posted June 19, 2015 La fel. Caut un om serios cu gamemode acceptabil, cu capabilitatea de a tine un host, serviciile oferite de mine sunt de scripter (experienta de 5 ani in C/C++ limbajul folosit de SA:MP). Nu am pretentii la bani, doar un server si un parteneriat frumos. Pentru mai multe detalii accept pm-uri. Universitatea de Vest din Timisoara, Facultatea de Matematica si Informatica Informatica aplicata, Anul I Link to comment Share on other sites More sharing options...
Rappy Posted June 19, 2015 Report Share Posted June 19, 2015 (edited) Atunci stai ca revin cu un edit si sa-ti arat cum poti s-o faci cu sscanf, mult mai okay.Pentru ca aceasta comanda sa functioneze iti trebuie pluginul sscanf si include-ul zcmd.CMD:setvw(playerid, params[]) { if(IsPlayerConnected(playerid)) { if(gLogged[playerid] == 1) { if (PlayerInfo[playerid][pAdmin] >= 1) { new targetid, vw; if(sscanf(params,"ui", targetid, vw)) return SendClientMessage(playerid, COLOR_SYN, "Synthax: /setvw <playerid/PartOfName> <vw>"); if(IsPlayerConnected(targetid)) { if(targetid != INVALID_PLAYER_ID) { GetPlayerName(playerid, pName, sizeof(pName)); GetPlayerName(targetid, pNameGive, sizeof(pNameGive)); SetPlayerVirtualWorld(targetid, vw); format(string, sizeof(string), "Adminul %s i-a setat lui %s virtualworld %d.", pName,pNameGive,vw); SCMAdmins(string); format(string, sizeof(string), "Adminul %s ti-a setat virtualworld %d.", pName,vw); SendClientMessage(playerid, COLOR_LIGHTRED2, string); } } } } } return 1; } Edited June 19, 2015 by Rappy Link to comment Share on other sites More sharing options...
Alexander. Posted June 19, 2015 Author Report Share Posted June 19, 2015 Multumesc, dar totusi astept sa ma lumineze cineva la comanda mea. Caut un om serios cu gamemode acceptabil, cu capabilitatea de a tine un host, serviciile oferite de mine sunt de scripter (experienta de 5 ani in C/C++ limbajul folosit de SA:MP). Nu am pretentii la bani, doar un server si un parteneriat frumos. Pentru mai multe detalii accept pm-uri. Universitatea de Vest din Timisoara, Facultatea de Matematica si Informatica Informatica aplicata, Anul I Link to comment Share on other sites More sharing options...
Rappy Posted June 19, 2015 Report Share Posted June 19, 2015 (edited) La comanda ta problema este legata de asteatemp = strtok(cmdtext, idx); targetid = ReturnUser(temp); in = strval(temp);Dar eu am lucrat numai cu ZCMD si sscanf asa ca nu prea imi dau seama ce-i in neregula acolo. Edited June 19, 2015 by Rappy Link to comment Share on other sites More sharing options...
Alexander. Posted June 19, 2015 Author Report Share Posted June 19, 2015 In cele din urma am rezolvat treaba cu parametrii, strebuie pus acel strlen dupa fiecare temp = ...Problema e alta acum, dupa executare (completa, face tot ce am vrut eu) imi da "SERVER: Unknown command!", ce este de facut? Stiu ca este de la return-urile acelea dar am incercat orice posibilitate dar nimic...Aceasta este comanda actuala:if(strcmp(cmd, "/setvw", true) == 0) { if(IsPlayerConnected(playerid)) { if(gLogged[playerid] == 1) { if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Error: Your admin level is not high enough to use this command."); temp = strtok(cmdtext, idx); if(!strlen(temp)) { SendClientMessage(playerid, COLOR_SYN, "Synthax: /setvw <playerid/PartOfName> <vw>"); return 1; } targetid = ReturnUser(temp); temp = strtok(cmdtext, idx); if(!strlen(temp)) { SendClientMessage(playerid, COLOR_SYN, "Synthax: /setvw <playerid/PartOfName> <vw>"); return 1; } new in = strval(temp); if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ERROR, "Error: Player-ul respectiv nu este conectat."); GetPlayerName(playerid, pName, sizeof(pName)); GetPlayerName(targetid, pNameGive, sizeof(pNameGive)); SetPlayerVirtualWorld(targetid, in); format(string, sizeof(string), "Adminul %s i-a setat lui %s virtualworld %d.", pName,pNameGive,in); SCMAdmins(string); format(string, sizeof(string), "Adminul %s ti-a setat virtualworld %d.", pName,in); SendClientMessage(playerid, COLOR_LIGHTRED2, string); return 1; } } } Caut un om serios cu gamemode acceptabil, cu capabilitatea de a tine un host, serviciile oferite de mine sunt de scripter (experienta de 5 ani in C/C++ limbajul folosit de SA:MP). Nu am pretentii la bani, doar un server si un parteneriat frumos. Pentru mai multe detalii accept pm-uri. Universitatea de Vest din Timisoara, Facultatea de Matematica si Informatica Informatica aplicata, Anul I Link to comment Share on other sites More sharing options...
Alexander. Posted June 19, 2015 Author Report Share Posted June 19, 2015 //REZOLVAT! Caut un om serios cu gamemode acceptabil, cu capabilitatea de a tine un host, serviciile oferite de mine sunt de scripter (experienta de 5 ani in C/C++ limbajul folosit de SA:MP). Nu am pretentii la bani, doar un server si un parteneriat frumos. Pentru mai multe detalii accept pm-uri. Universitatea de Vest din Timisoara, Facultatea de Matematica si Informatica Informatica aplicata, Anul I Link to comment Share on other sites More sharing options...
Recommended Posts