28.08.2009, 09:46
i need help conveting these's code's to dcmd
1.login.....
2....onplayerlogin
i need someone to help me with this coz for some reson i keep fucking it up
3...register
ok so the first one i dont know what to do coz of the cmdtext
and for the 3erd one i dont know what to do
thx for ur time
1.login.....
Код:
new cmd[256]; new idx; cmd = strtok(cmdtext, idx); new tmp[256]; new playername[MAX_PLAYER_NAME]; new string[256]; new moneys; new giveplayer[MAX_PLAYER_NAME]; new giveplayerid; { if(IsPlayerConnected(playerid)) { new tmppass[64]; if(gPlayerInfo[playerid][PLAYER_LOGGED] == 1) { SendClientMessage(playerid, COLOUR_ORANGE, " You are already logged in."); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOUR_ORANGE, " USAGE: /login [password]"); return 1; } strmid(tmppass, tmp, 0, strlen(cmdtext), 255); Encrypt(tmppass); OnPlayerLogin(playerid,tmppass); } return 1; } }
2....onplayerlogin
i need someone to help me with this coz for some reson i keep fucking it up
3...register
Код:
if (strcmp(cmd, "/register", true)==0) { //new string[265]; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /register [password]"); return 1; } if (gPlayerAccount[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, " That name is already registered"); return 1; } strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(cmdtext), 255); Encrypt(PlayerInfo[playerid][pPassword]); GetPlayerName(playerid, playername, sizeof(playername)); format(string, sizeof(string), "%s.cer", playername); new File: file = fopen(string, io_read); if (file) { SendClientMessage(playerid, COLOR_GREY, " That name is already registered"); fclose(file); return 1; } new File:hFile; hFile = fopen(string, io_append); new var[32];// format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var); format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var); format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var); PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid); format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var); format(var, 32, "Bank=%d\n",PlayerInfo[playerid][pBank]);fwrite(hFile, var); fclose(hFile); SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!"); SendClientMessage(playerid, COLOR_WHITE, "Next time you connect, type /login <password> to log in."); OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]); return 1; }
ok so the first one i dont know what to do coz of the cmdtext
and for the 3erd one i dont know what to do
thx for ur time